NetXMS Support Forum

English Support => General Support => Topic started by: Egert143 on September 29, 2025, 08:52:34 AM

Title: Monitoring ubuntu service status
Post by: Egert143 on September 29, 2025, 08:52:34 AM
Hello

What are the steps to monitor ubuntu service status?

Egert
Title: Re: Monitoring ubuntu service status
Post by: Filipp Sudanov on October 03, 2025, 04:43:50 PM
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")