Please reference the Topic I opened previously: https://support.nagios.com/forum/viewto ... 16&t=52143
I am having trouble on RHEL6 servers in our environment where the nagios user does not have sufficient permissions to perform service checks on all services defined.
I have taken several steps in attempting to resolve the issue as follows:
1. Added --> (root) NOPASSWD: /sbin/service * status
2. Created an alias --> alias service='sudo /sbin/service'
3. Tested the use of the sudo/alias combo
Code: Select all
-bash-4.1$ service rsyslog status
rsyslogd (pid 1868) is running...
When performing a passive check I get the results:
CRITICAL: rsyslog is unknown (should be running)
And when I attempt an Active check I get the same results:
Code: Select all
./check_ncpa.py -H 69.91.2xx.x -P 3181 -t 'mytoken' -M 'services' -q 'service=rsyslog,status=running' -v
Connecting to: https://69.91.2xx.x:3181/api/services/?token=mytoken&check=1&service=rsyslog&status=running
File returned contained:
{
"returncode": 2,
"stdout": "CRITICAL: rsyslog is unknown (should be running)"
}
CRITICAL: rsyslog is unknown (should be running)
Does it execute a 'service -status-all' and then parse the whole results looking for the specific service name?
Does it do something like a direct call to /sbin/service and therefore by-passing my attempt to use sudo to circumvent the shortcomings?
Can someone please explain how it actually works so I can try and devise a way to monitor services on RHEL6?
Any help in solving would be greatly appreciated...
Thanks,
Danny