Check NRPE Services. OK in Shell and Wrong 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
dliberal
Posts: 5
Joined: Mon Jan 07, 2019 10:39 am

Check NRPE Services. OK in Shell and Wrong in Nagios

Post by dliberal »

I have a problem in Nagios Core when I try to monitor Services.

In Linux shell these comands works OK

./check_nrpe -H x.x.x.x -n -c checkservicestate -a CheckAll exclude=SysmonLog
Ok: All 118 service(s) are ok.

./check_nrpe -H x.x.x.x -n -c check_service -a "filter=start_type = 'auto' and name not in ('SysmonLog')"

Ok: All 118 service(s) are ok.

But in Nagios when I try these commands, they show a CRITICAL Alarm

check_command check_nrpe!checkservicestate! -a CheckAll exclude=SysmonLog

CRITICAL: SysmonLog stopped delayed ()

check_command check_nrpe!check_service! -a "filter=start_type = 'auto' and name not in ('SysmonLog')"[/b]
CRITICAL: SysmonLog stopped delayed ()

I do not know what I'm doing wrong, I do not understand.

Please I need help. I'm desperate
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Check NRPE Services. OK in Shell and Wrong in Nagios

Post by mcapra »

Can you share your Nagios command definition for the check_nrpe command?
Former Nagios employee
https://www.mcapra.com/
dliberal
Posts: 5
Joined: Mon Jan 07, 2019 10:39 am

Re: Check NRPE Services. OK in Shell and Wrong in Nagios

Post by dliberal »

In commands.cfg file

define command{
command_name check_nrpe
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -t 60 -n
}

In windows.cfg file

define service {
host_name MyServer
service_description Automatic Services
check_command check_nrpe!checkservicestate! -a CheckAll exclude=SysmonLog
#check_command check_nrpe!check_service!-a "filter=start_type = 'auto' and name not in ('SysmonLog')" exclude=SysmonLog

max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}

I thought that maybe it could be due to an argument problem, but I discard it since this command works correctly.

define service {
host_name MyServer
service_description Disk Use
check_command check_nrpe!check_drivesize! "crit=free<10%" "warn=free<20%" drive=c:
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Check NRPE Services. OK in Shell and Wrong in Nagios

Post by npolovenko »

@dliberal, Can you wrap the whole argument in double quotes inside the Nagios command?
check_command check_nrpe!checkservicestate! -a "CheckAll exclude=SysmonLog"
Restart the nagios service with:
service nagios restart
And let me know if the check works in the GUI.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dliberal
Posts: 5
Joined: Mon Jan 07, 2019 10:39 am

Re: Check NRPE Services. OK in Shell and Wrong in Nagios

Post by dliberal »

I tried

check_command check_nrpe!checkservicestate! -a "CheckAll exclude=SysmonLog"

but it still does not work
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Check NRPE Services. OK in Shell and Wrong in Nagios

Post by npolovenko »

@dliberal, Can you upload the status.dat file or send it to me in a PM?
/usr/local/nagios/var/status.dat
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dliberal
Posts: 5
Joined: Mon Jan 07, 2019 10:39 am

Re: Check NRPE Services. OK in Shell and Wrong in Nagios

Post by dliberal »

In /usr/local/nagios/var/status.dat file it shows:

plugin_output=CRITICAL: SysmonLog=stopped (auto), delayed ()
dliberal
Posts: 5
Joined: Mon Jan 07, 2019 10:39 am

Re: Check NRPE Services. OK in Shell and Wrong in Nagios

Post by dliberal »

I have changed in Windows the service from "Automatic" to "Manual" and then the output is:

OK: All 119 service(s) are ok.

It seems that the "exclude = SysmonLog" argument does not work

I do not know if there is a problem changing the service from automatic to manual in Windows
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Check NRPE Services. OK in Shell and Wrong in Nagios

Post by npolovenko »

@dliberal, Change the nrpe command like this and try again:
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ $ARG2$ -t 60 -n
And as for the service command, try with double quotes and without:
check_command check_nrpe!checkservicestate! -a "CheckAll exclude=SysmonLog"
And without:
check_command check_nrpe!checkservicestate! -a CheckAll exclude=SysmonLog
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked