Pass plugin options like arguments

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
monitor
Posts: 1
Joined: Fri Apr 24, 2015 3:43 am

Pass plugin options like arguments

Post 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.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Pass plugin options like arguments

Post 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!
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Pass plugin options like arguments

Post 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
Locked