Linux Host check_command for NRPE version

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
tuathano
Posts: 1
Joined: Wed Dec 12, 2018 6:24 am

Linux Host check_command for NRPE version

Post by tuathano »

I have set up Nagios® Core™ 4.3.4 and configured to monitor a linux box using NRPE and Windows machine using NSClient++.

I have defined the host in a cfg file and service checks for Hard disk usage and PING in another cfg file. Initially the host check command was also a PING and it correctly indicated that the Host was "UP" and all services were "OK". I have changed the host check_command to query the NRPE version installed:

Code: Select all

define host {
        host_name                       XXX-XXXX
        alias                           XXX-XXXX
        [b]check_command                   check_nrpe!check_nrpeversion[/b]
        max_check_attempts              5
        check_interval                  0.08
        retry_interval                  0.08
        check_period                    24x7
        contacts                        nagiosadmin
        icon_image                      nrpe.png
        statusmap_image                 nrpe.png
}
but now Nagios indicates the host is "DOWN" (even though this is not the case and all service are still "OK"). How can I fix this?

For the Windows machine this work ok i.e. my cfg file has the following:

Code: Select all

define host {
    host_name               XXXXXXX
[b]    check_command           check_nscpp!CLIENTVERSION[/b]
    max_check_attempts      5
    check_interval          0.08
    retry_interval          0.08
    check_period            24x7
    contacts                nagiosadmin
    icon_image              nscpp.png
    statusmap_image         nscpp.png
}
and the host is indicated as "UP" with status information: "NSClient++ 0.5.2.35 2018-01-28 "
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Linux Host check_command for NRPE version

Post by mcapra »

Strictly speaking, you shouldn't actually need to call a specific remote NRPE command to get the version info back. check_nrpe can do that natively:

Code: Select all

[root@capra_nag linux-nrpe-agent]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
NRPE v3.2.1
[root@capra_nag linux-nrpe-agent]# echo $?
0
And it should always return "OK" unless the remote NRPE server is down:

Code: Select all

[root@capra_nag linux-nrpe-agent]# systemctl stop xinetd
[root@capra_nag linux-nrpe-agent]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
connect to address 127.0.0.1 port 5666: Connection refused
connect to host 127.0.0.1 port 5666: Connection refused
[root@capra_nag linux-nrpe-agent]# echo $?
2
So you'd really just create a new check_nrpe command definition on the Nagios Core end of things (maybe call it check_nrpe_host?) which only accepts the $HOSTADDRESS$ to plug into -H and no other args.

If you still require additional troubleshooting, can you share the check_nrpeversion command definition from your nrpe.cfg file on the remote machine? Also, the versions of your check_nrpe plugin and remote NRPE server.
Former Nagios employee
https://www.mcapra.com/
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Linux Host check_command for NRPE version

Post by scottwilkerson »

I would tend to agree, I would make a check_nrpe_version command like so

Code: Select all

define command {
    command_name    check_nrpe
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30
}
Then modify your host to just be as follows:

Code: Select all

define host {
        host_name                       XXX-XXXX
        alias                           XXX-XXXX
        check_command                   check_nrpe_version
        max_check_attempts              5
        check_interval                  0.08
        retry_interval                  0.08
        check_period                    24x7
        contacts                        nagiosadmin
        icon_image                      nrpe.png
        statusmap_image                 nrpe.png
}
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked