Page 1 of 1

check_service reporting incorrectly in Nagios

Posted: Tue May 28, 2019 9:36 am
by razermuse
Hello,

I'm using the check_service plugin which uses systemctl to determine if a service is running or not. When I run the command locally, I get one result. When I run the command using Nagios Core, I get something different.

Here's the output:

ubuntu@ip-redacted:/usr/lib/nagios/plugins$ ./check_service -s [service]
OK: Service [service] is running!


But in the Nagios user interface:

CRITICAL: Service [service] is not running!

It seems so simple yet I have absolutely no idea why it's getting it wrong.

Re: check_service reporting incorrectly in Nagios

Posted: Tue May 28, 2019 12:20 pm
by scottwilkerson
My guess is that you need to add check_service to the sudoers file for you nrpe user (either nagios or nrpe depending on how you installed)

Then change your check_service command in your nrpe.cfg to call sudo first
such as

Code: Select all

command[check_service]=sudo /usr/local/nagios/libexec/check_service -s $ARG1$
This is just an example, your setup/path may vary