Passing custom arguments to Nagios NRPE commands

This forum is intended for the discussion of Nagios Core development. Feature requests, patches, bug fixes, and all types of development-related discussions are welcome!

NOTE: The SourceForge.net nagios-devel mailing list has been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Passing custom arguments to Nagios NRPE commands

Postby rahuls » Wed Jan 11, 2017 2:42 am

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 ?
rahuls
 
Posts: 1
Joined: Wed Jan 11, 2017 2:18 am

Re: Passing custom arguments to Nagios NRPE commands

Postby tmcdonald » Wed Jan 11, 2017 10:20 am

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.
Want to see me get thrown into a box? https://www.youtube.com/watch?v=pGSlqxIMxQM
User avatar
tmcdonald
Support Manager
 
Posts: 7913
Joined: Mon Sep 23, 2013 8:40 am


Return to Nagios Core Development

Who is online

Users browsing this forum: No registered users and 1 guest