Monitoring ubuntu service status

Started by Egert143, September 29, 2025, 08:52:34 AM

Previous topic - Next topic

Egert143

Hello

What are the steps to monitor ubuntu service status?

Egert

Filipp Sudanov

At some point we will add built-in metric for systemd servicees (https://track.radensolutions.com/issue/NX-2841)

Currently this can be done by configuring ExternalMetric that would call systemctl show SERVICE_NAME --no-pager and pipe it to grep to get the status...
or you can try the new agent functionality that parses xml or json data provided by external commands. It's called external data provider, documented here: https://netxms.org/documentation/adminguide/agent-management.html#externaldataprovider

Add the following to agent configuration file:

### Data provider for systemd service information
[ExternalDataProvider/systemdServices]
Command = systemctl list-units --type service --full --all --output json --no-pager
Description = Data provider for systemctl json output

agent will now have systemdServices() metric that supports jq query as parameter and here's example of metric to get status of cron service:

systemdServices(".[]|select(.unit==""cron.service"")|.active")