Services are not recognized

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
wagnbeu0
Posts: 25
Joined: Tue Nov 03, 2015 5:28 am

Services are not recognized

Post by wagnbeu0 »

I have an server up&running with an Relianoid Loadbalancer based on Debian.
I have setup some monitorring services for

Code: Select all

ssh
cherokee
cron
zevenet
the syntax is always:

Code: Select all

$USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$ -t 'token' -P 5693 -M 'services' -q 'service=zevenet,status=running'
$USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$ -t 'token' -P 5693 -M 'services' -q 'service=ssh,status=running'
$USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$ -t 'token' -P 5693 -M 'services' -q 'service=cron,status=running'
$USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$ -t 'token' -P 5693 -M 'services' -q 'service=cherokee,status=running'
When running systemctl is get always return that the service is up&running.

Code: Select all

# systemctl status cherokee
● cherokee.service - LSB: cherokee
     Loaded: loaded (/etc/init.d/cherokee; generated)
     Active: active (exited) since Mon 2024-06-17 15:49:56 CEST; 22h ago
       Docs: man:systemd-sysv-generator(8)
        CPU: 51ms

Jun 17 15:49:56 hostname systemd[1]: Starting cherokee.service - LSB: cherokee...
Jun 17 15:49:56 hostname cherokee[716]: Starting cherokee web server: cherokee                [ OK ]
Jun 17 15:49:56 hostname systemd[1]: Started cherokee.service - LSB: cherokee.

when running the syntax aboive I get:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H hostname -t 'token' -P 5693 -M 'services' -q 'service=cherokee,status=running'
UNKNOWN: No services found for service names: cherokee
I have no idea what here is going wrong ....
ssunga
Posts: 72
Joined: Wed Aug 09, 2023 10:38 am

Re: Services are not recognized

Post by ssunga »

What output do you see when running (with the correct host and token):

/usr/local/nagios/libexec/check_ncpa.py -H ...-t '...' -P 5693 -M 'services'

This should return a list of available services. You should also be able to see a list of available services in the NCPA web interface. The names used by systemctl and the names used by NCPA might differ.

It might also be helpful to look at logs:

/usr/local/ncpa/var/log/ncpa_listener.log
/usr/local/ncpa/var/log/ncpa_passive.log
User avatar
lgute
Posts: 411
Joined: Mon Apr 06, 2020 2:49 pm

Re: Services are not recognized

Post by lgute »

Hi @wagnbeu0, thanks for reaching out.

Have you tried using the NCPA GUI?

In a browser navigate to https://hostname:5693. Where hostname is the ip address or hostname of the server you want to monitor. You may have to click through the browser's advanced security option to be able to continue on (due to the https). Use the same token to login to NCPA gui as you are using on the command line.

Click on the API tab and select services as the API Endpoint. This will show you the services available to monitor and the name you need to use in the check.

For instance, on my server, the ssh service is listed as "sshd": "running", so the check syntax is like this...

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H 192.168.58.128 -t '<reallylongtoken>' -P 5693 -M 'services' -q 'service=sshd,status=running'
Output:

Code: Select all

OK: sshd is running
Please let us know if you have any other questions or concerns.

-Laura
Post Reply