Page 1 of 1

Passing custom arguments to Nagios NRPE commands

Posted: Wed Jan 11, 2017 2:42 am
by rahuls
I have custom nagios check for checking database replication. I have defined service for this as follows in services.cfg,

Code: Select all

define service {
        check_command           check_londiste
        host_name               host01,host02
        service_description     londiste
        use                     generic-service
}
defined command as follows in checkcommands.cfg,

Code: Select all

define command {
        command_name    check_londiste
        command_line    $USER1$/check_nrpe -u -H $HOSTADDRESS$ -c check_londiste
}
Note : check_londiste is my custom script to check replication status.

I have this nrpe check on client side, that is in /etc/nagios/nrpe.d/check_londiste.cfg,

Code: Select all

command[check_londiste]=/usr/bin/sudo /usr/lib/nagios/plugins/check_londiste
and from server side I run this command to get the status

Code: Select all

./check_nrpe -u -H host01 -c check_londiste
if runs fine, but what I need to do is, I would want to give arguments to this check. Like

Code: Select all

./check_nrpe -u -H host01 -c check_londiste -a $ARG1$ $ARG2$
How can I achieve this ?

Re: Passing custom arguments to Nagios NRPE commands

Posted: Wed Jan 11, 2017 10:20 am
by tmcdonald
There are a few things you will need to do in the NRPE compilation and configuration side:

http://www.thegeekstuff.com/2010/12/ena ... arguments/

Give that a read and let us know if you have specific questions on any of the steps.