Page 1 of 1

NCPA service check returns unknown

Posted: Tue Sep 18, 2018 6:37 am
by hbouma
I have 2 REHL 6 64bit servers that are failing on 1 service check. The process is running, but the check returns an unknown state. What types of things should I look for to troubleshoot the agent check against this service? Other services work fine.

root@SERVER1 [/root]
$ ps -ef | grep rsyslog
root 1657 1 0 Aug12 ? 00:01:24 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5


root@SERVER2 [/root]
$ ps -ef | grep rsyslog
root 1901 1 0 Aug01 ? 00:04:00 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5

Re: NCPA service check returns unknown

Posted: Tue Sep 18, 2018 2:54 pm
by lmiltchev
You have a few options the way I see it:

1. Change uid and gid from nagios to root in the ncpa.cfg file.

Code: Select all

uid = root
gid = root
and restart ncpa_listener service.

Code: Select all

service ncpa_listener restart
2. Check for the rsyslog process (instead of a service).

Example:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t '<your token>' -M 'processes' -q 'name=rsyslog,match=search'
3. Use a custom script on the remote machine that checks if rsyslog is running, which you can call via NCPA.

Example script:

Code: Select all

#!/bin/bash

service=$1
count=$(ps -ef | grep -v grep | grep $service | wc -l)

if [ "$count" = "0" ]; then
  echo "$service is NOT running"
else
  echo "$service is running"
fi
Example check:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t '<your token>' -M 'plugins/check_rsyslog.sh' -q 'args=rsyslog'
4. Upgrade to CentOS 7
On RHEL 7, nagios user will be able to check the status on all services. This works differently, compared to RHEL 6.

Re: NCPA service check returns unknown

Posted: Tue Sep 18, 2018 3:03 pm
by hbouma
Changing it to a process check does work.

Re: NCPA service check returns unknown

Posted: Tue Sep 18, 2018 3:13 pm
by ssax
Ok, are we okay to mark this as resolved and lock the topic?

Re: NCPA service check returns unknown

Posted: Tue Sep 18, 2018 3:20 pm
by hbouma
Go ahead