You can monitor an agent’s state on your servers by using a Unix Domain Socket (UDS) located at:
This feature is available on:
- Cmd Control agent versions 1.4.0 or later;
- Cmd Audit agent versions 1.0.0 or later.
- How to turn on the status API
- How to read the status of the Cmd Control or Cmd Audit agent
How to turn on the API
You can enable the end point by either of these methods:
Add the line
echo diagnostics_interface=1 | sudo tee --append /etc/cmd/config.ini
- Env. var.:
Add the line
/etc/cmd/cmd.service, under where it says
(If they differ, the env. var. will take precedence over the config variable.)
After updating the config.ini or setting the env. var., restart the agent to apply the updates.
How to read the status
With the API turned on, you can read from the socket, e.g.:
nc -U /var/run/cmd/diag.1.sock . The agent will return a status message (a dash-delimited string), then close the connection.
The status message has four state fields, and its format is as follows:
<Offline DB Filtering Policy>-<High Latency Mode>-<Collector Connection State>-<Throttle State> . The Cmd Audit agent has one additional field, detailed in table 2, below.
Table 1. Agent Status API: fields and values
For example, a status message from the Cmd Control agent could look like this:
Note that NULL values will be omitted from status message, so a status message could also look like this:
Table 2. Agent-status API: Cmd Audit-specific fields
When a Cmd Audit agent reports its status, the Probe Load State appears at the end of the diagnostic string.