Page 1 of 1
Check NRPE Services. OK in Shell and Wrong in Nagios
Posted: Mon Jan 07, 2019 11:08 am
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
Re: Check NRPE Services. OK in Shell and Wrong in Nagios
Posted: Mon Jan 07, 2019 11:22 am
by mcapra
Can you share your Nagios
command definition for the
check_nrpe command?
Re: Check NRPE Services. OK in Shell and Wrong in Nagios
Posted: Mon Jan 07, 2019 11:54 am
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
}
Re: Check NRPE Services. OK in Shell and Wrong in Nagios
Posted: Mon Jan 07, 2019 4:07 pm
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.
Re: Check NRPE Services. OK in Shell and Wrong in Nagios
Posted: Mon Jan 07, 2019 4:38 pm
by dliberal
I tried
check_command check_nrpe!checkservicestate! -a "CheckAll exclude=SysmonLog"
but it still does not work
Re: Check NRPE Services. OK in Shell and Wrong in Nagios
Posted: Mon Jan 07, 2019 4:42 pm
by npolovenko
@dliberal, Can you upload the status.dat file or send it to me in a PM?
/usr/local/nagios/var/status.dat
Re: Check NRPE Services. OK in Shell and Wrong in Nagios
Posted: Mon Jan 07, 2019 11:34 pm
by dliberal
In /usr/local/nagios/var/status.dat file it shows:
plugin_output=CRITICAL: SysmonLog=stopped (auto), delayed ()
Re: Check NRPE Services. OK in Shell and Wrong in Nagios
Posted: Mon Jan 07, 2019 11:50 pm
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
Re: Check NRPE Services. OK in Shell and Wrong in Nagios
Posted: Tue Jan 08, 2019 4:01 pm
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