Page 1 of 1

Pass plugin options like arguments

Posted: Fri Apr 24, 2015 5:31 am
by monitor
Hi Guys.

I need to know if it's possible to pass a plugin option like "-w" or "-c" throuth nrpe like Argument.

I mean:

I have the next command definition: $USER1$/check_nrpe -H $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
/check_nrpe -H x.x.x.x -c check_disk -w 20% -c 30% -p /



and it's call to the next client command: command[check_arg]=/usr/local/nagios/libexec/$ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$


There is any way to get some thing like this?


Thanks a lot.

Re: Pass plugin options like arguments

Posted: Fri Apr 24, 2015 11:48 am
by jolson
This should not be an issue.

On your remote client, we will have to modify the nrpe.cfg file to allow argument passing. Please note that enabling this option will make NRPE less secure.

Code: Select all

vi /usr/local/nagios/etc/nrpe.cfg
Change:

Code: Select all

dont_blame_nrpe=0
to:

Code: Select all

dont_blame_nrpe=1
Restart xinetd:

Code: Select all

service xinetd restart
From your Nagios host, you will now be able to pass command line arguments as follows:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_disk -a '-w 20% -c 50% -p /'
Let me know if this helps - thanks!

Re: Pass plugin options like arguments

Posted: Fri Apr 24, 2015 11:49 am
by jdalrymple
While not particularly safe, it's likely possible:

nrpe.cfg

Code: Select all

command[check_arbitrary]=/usr/local/nagios/libexec/$ARG1$

Code: Select all

[jdalrymple@localhost libexec]$ ./check_nrpe -H 127.0.0.1 -c check_arbitrary -a 'check_dummy 0'
OK
[jdalrymple@localhost libexec]$ ./check_nrpe -H 127.0.0.1 -c check_arbitrary -a '../../../../bin/ls'
bin
boot
dev
etc
home
lib
lib64
lost+found
media
mnt
opt
proc
root
sbin
selinux
srv
store
sys
tmp
usr
var