check_service reporting incorrectly in Nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
razermuse
Posts: 1
Joined: Sun May 26, 2019 11:00 pm

check_service reporting incorrectly in Nagios

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_service reporting incorrectly in Nagios

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked