Page 1 of 1

check_nrpe calling nsclient unknown status

Posted: Wed Apr 10, 2019 9:03 pm
by staylor8
I am using

Code: Select all

Nagios Core Version 4.2.0
NSClient++ 0.4.3.143 2015-04-29 x64
When I launch NSclient in Test mode this command works fine.

Code: Select all

check_service "filter=name='OpenVPNService'" "empty-state=critical"
If I manually run this from nagios:

Code: Select all

./libexec/check_nrpe -H server.domain.com -c check_service -a "filter=name='OpenVPNService'" "empty-state=critical"
I get this back:

Code: Select all

OK: All 1 service(s) are ok.
When I use my service definition:

Code: Select all

define service {
        use                     generic-service
        host_name               server
        service_description     OpenVPN Tunnel Status
        check_command           check_nrpe!server.domain.com!check_service -a "filter=name'OpenVPNService'" "empty-state=critical"
}
I only get a status of UNKNOWN in the web UI

What am I missing?

Thanks,

Shawn

Re: check_nrpe calling nsclient unknown status

Posted: Thu Apr 11, 2019 3:26 pm
by swolf
Hi @staylor8,

I don't have a Nagios Core instance open right now, but on my Nagios XI machine check_nrpe is defined as follows:

Code: Select all

define command {
    command_name    check_nrpe
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
As far as I remember this is the same as in Nagios Core, but you may want to verify.

If this is true, then your current service will be executing a command line like

Code: Select all

./libexec/check_nrpe -H server.domain.com -t 30 -c server.domain.com check_service -a "filter=name'OpenVPNService'" "empty-state=critical"
$HOSTADDRESS$ will be taken off of the config for 'server', so you should be able to change your service config to the following:

Code: Select all

define service {
        use                     generic-service
        host_name               server
        service_description     OpenVPN Tunnel Status
        check_command           check_nrpe!check_service -a "filter=name'OpenVPNService'" "empty-state=critical"
}
Let me know if that works for you!