cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DQL number of currently connected hosts to ActiveGate

elenaperez
Dynatrace Contributor
Dynatrace Contributor

Hi team,

Is it possible to get the number of currently connected hosts to an ActiveGate using DQL?
The number is in the deployment status page, when you select an ActiveGate under properties, but I was wondering if it is possible to get it via DQL.

The metric dsfm:active_gate.communication.agent_modules.connected gives you the number of connected OneAgent modules but not the hosts.

Thanks in advance!

5 REPLIES 5

marina_pollehn
DynaMight Champion
DynaMight Champion

Okay this is not a 100% what you're asking for, but you can summarize the agents/hosts split by network zone, so this would be the same if you only have one ActiveGate per network zone (yea strong assumption here...). 

fetch dt.entity.host
| summarize OneAgents=count(), by:{networkZone}

More of a potential workaround/quick fix but maybe it helps.

A Dynatrace Professional nerd working for Conclusion Xforce

Hi Marina, 

Thank you for your answer. However, there are more than 1 ActiveGates per Network Zone. What we did in the end is use Javascript:

import { activeGatesClient } from '@dynatrace-sdk/client-classic-environment-v2';

export default async function () {
    let nextPageKey;
  
    do {
      const config = nextPageKey ? { nextPageKey: nextPageKey } : {
        hostname: "AGNAME"
      }
      const res = await activeGatesClient.getAllActiveGates(config);
      nextPageKey = res.nextPageKey;
      return res.activeGates[0].connectedHosts;
    } while (nextPageKey);

}

marina_pollehn
DynaMight Champion
DynaMight Champion

timeseries by:{dt.active_gate.id}, connected_OneAgents = sum(dt.sfm.active_gate.communication.agent_modules.connected)
|FieldsKeep dt.active_gate.id, connected_OneAgents

?

A Dynatrace Professional nerd working for Conclusion Xforce

The problem here is this metric provides the number of modules connected, not the agents. If the agent has more than one module, the number is much higher.

I think this is the closest I can get for now 😞 Maybe if we can append the related entity and make a unique count we could be getting somewhere.

A Dynatrace Professional nerd working for Conclusion Xforce

Featured Posts