debianmonitoringnagiosnrpe

NSClient++ commands for NRPE with Windows Server 2012 from Icinga


I have researched this problem for days but I can't come to a solution. I have a Windows 2012 server with NSClient++ installed on this. I have also an Icinga server with the Nagios NRPE plugin installed. Also, the NSClient++ is configured to accept NRPE commands and the "allow arguments = 1" is set. From the Icinga server, when I give this input:

/usr/lib/nagios/plugins/check_nrpe -H 192.168.1.22 -c alias_cpu

it gives this: OK CPU Load ok.|'5m'=27%;80;90 '1m'=26%;80;90 '30s'=26%;80;90


So everything looks totally fine, but from the Icinga webinterface, I get this error: /usr/lib/nagios/plugins/check_nrpe: option requires an argument -- 'a'

It looks that I just can't get the commands right. I tried every command I found on the internet but none of them works fine. Also, the NSClient documentation for NRPE is outdated, as they say that you should use check_nt but that command is deprecated for over a year now, so I should use check_nrpe but that doesn't work eiter.

So I created a .cfg file in /etc/icinga/objects and I am currently using these commands:

define host{
       use windows-servers
       host_name host.domain.com
       alias host
       address 192.168.1.22
}

define service{
        use                             generic-service
        host_name                       host.domain.com
        service_description             Drive Usage
        check_command                   check_nrpe!alias_disk
        }


define service{
        use                     generic-service
        host_name               host.domain.com
        service_description     CPU Load
        check_command           check_nrpe!alias_cpu
}

On the Windows Server, the settings in the nsclient.ini are these:

[/settings/NRPE/server]
allowed hosts=172.16.0.7
allow arguments=1
port=5666
allow nasty_meta chars=1 
use SSL = 1

Does anyone has an idea what is going wrong here? I am totally out of options now. Am I gving wrong commands? Does anyone know the right commands? Or am I doing something else wrong? Thanks!


Solution

  • With the help of the Icinga/Nagios forum, I found out that define_command was this:

    # this command runs a program $ARG1$ with arguments $ARG2$
    define command {
            command_name    check_nrpe
            command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
    }
    
    # this command runs a program $ARG1$ with no arguments
    define command {
            command_name    check_nrpe_1arg
            command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
    }
    

    And should be this:

    # this command runs a program $ARG1$ with arguments $ARG2$
    define command {
            command_name    check_nrpe_1arg
    
            command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
    }
    
    # this command runs a program $ARG1$ with no arguments
    define command {
            command_name    check_nrpe
            command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
    }
    

    Only swapped two lines but cost me days to find out. But fortunately, it's solved now.