Skip to content

Agent health metrics

The agent reports on its own health, so you can tell whether it is alive and whether its collector is running without logging in to the host. These liveness metrics are reported out-of-band, on a path that does not go through the collector. So they keep arriving even when the collector is down.

The agent reports these metrics, all carrying the resource attributes below:

MetricMeaning
kmagent.upHeartbeat. Its absence is the signal that the agent, host, or network is down.
kmagent.uptimeTime since the agent process started.
kmagent.goroutinesInternal thread count, useful for spotting a leak.
kmagent.memory.rssAgent process memory.
kmagent.cpu.utilizationAgent process CPU.
kmagent.collector.upWhether the embedded collector is running (1 or 0), with state and reason attributes.
kmagent.collector.restartsHow many times the collector has been restarted.
kmagent.config.apply.successWhether the last configuration push applied cleanly (1 or 0).
kmagent.config.apply.errorsCumulative configuration-apply failures.

Resource attributes: service.name is kmagent (so you can target it directly in dashboards and alerts), plus host.name, agent.version, collector.version, os.type, and host.arch.

kmagent.collector.up carries a reason attribute that says why the collector is down, so you can tell the failure modes apart:

SituationSignal
Healthykmagent.collector.up=1, state=running
A bad configuration was pushedkmagent.collector.up=0, reason=config_invalid
The collector exited with an errorkmagent.collector.up=0, reason=run_error, restart count increases
The collector panickedkmagent.collector.up=0, reason=panic, restart count increases (then it auto-restarts)
A graceful shutdownreason=shutdown

The agent restarts the collector automatically after a crash, and the restart count records that it happened.

The one failure the agent cannot report is total silence. If the agent, host, or network goes down, nothing is emitted. Detect this with a dead-man’s-switch alert in KloudMate that fires when kmagent.up stops arriving for a host.

Health reporting is controlled by the agent’s settings. You can turn it on or off and set its interval through the agent configuration. These are the health-enabled and health-interval settings, which map to the KM_HEALTH_ENABLED and KM_HEALTH_INTERVAL environment variables. The default interval matches the agent’s check-in interval.