Discussion:
[Nagios-users] NRPE with command arguments
Enrico Zimol
2010-05-17 15:17:47 UTC
Permalink
Hello at all,
I'm looking to pass argument to nrpe, so I read that I've to set
dont_blame_nrpe to 1 and recompile with --enable-command-args.
My question is about if this recompiling will do effect on NRPE or on
check_nrpe plugin. I think first one, but I want confirm on that.
Is there some specifics documentation about it? because on officials
there aren't informations.
(for example I don't know what "make install-*" I've to do after recompiling)


Thank's so much

sorry for my bad english
Assaf Flatto
2010-05-17 15:28:29 UTC
Permalink
Post by Enrico Zimol
Hello at all,
I'm looking to pass argument to nrpe, so I read that I've to set
dont_blame_nrpe to 1 and recompile with --enable-command-args.
My question is about if this recompiling will do effect on NRPE or on
check_nrpe plugin. I think first one, but I want confirm on that.
Is there some specifics documentation about it? because on officials
there aren't informations.
(for example I don't know what "make install-*" I've to do after recompiling)
Thank's so much
sorry for my bad english
The recompile will not have any effect on the check_nrpe plugin , but
will change the way the nrpe daemon works and listens to the commands
sent from the nagios server .

about the "make" ,all you need to do is as follows :

./configure --enable-command-args
make
make install

then check the configuration , verify the init script and start nrpe .

after that - change the testing to work the way you want it .

( always good to have the debug of nrpe enabled while testing ).

Assaf
--
Never,Ever Cut A Deal With a Dragon


I am doing a Charity Bike ride On the 27 of June for the
Capital to Coast Charity. Please help by Donating
http://www.justgiving.com/Lovefilm-capital-to-coast
Enrico Zimol
2010-05-19 08:42:12 UTC
Permalink
Post by Assaf Flatto
after that - change the testing to work the way you want it
Hello, i'm testing that but I can't understand what is wrong on my
configurations.
(blame_nrpe e ricompiling it's ok)
On nrpe.cfg I defined this command:
command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$


And on nagios server I've this definitions:
http://pastebin.com/7uZRcMk9

Also enabling debug on nrpe deamon I see nothing during the command on messages:
May 19 08:21:54 blabla xinetd[24320]: START: nrpe pid=24336 from=192.168.234.234
May 19 08:21:54 blabla nrpe[24336]: INFO: SSL/TLS initialized. All
network traffic will be encrypted.
May 19 08:21:54 blabla xinetd[24320]: EXIT: nrpe status=0 pid=24336
duration=0(sec)


Any suggest or documentation?

Thank's!
Ludse Verhoeven
2010-05-19 09:13:37 UTC
Permalink
Hi there,

Your final command to invoke check_disk is
"check_nrpe!check_disk!$_HOSTDISKWARNING$!$_HOSTDISKCRITICAL$". Passing
this to check_nrpe will only get check_disk as an argument passed through
to nrpe (since your check_nrpe-command is "$USER1$/check_nrpe -H
$HOSTADDRESS$ -p $_HOSTNRPE_PORT$ -c $ARG1$"). This in turn starts the
check_disk-command via NRPE without any arguments (because
'_HOSTDISKWARNING' and '_HOSTDISKCRITICAL' will get passed as ARG2 and
ARG3 to check_nrpe) and in the end will cause check_disk only see a -w and
-c option without thresholds.

I think what needs to be done is pass the whole command with escaped
bang-characters to check_nrpe like this:
check_nrpe!check_disk\!$_HOSTDISKWARNING$\!$_HOSTDISKCRITICAL$
or maybe even enclose it in single or double quotes so it gets passed
through as 1 argument to check_nrpe.....

Not sure if this works like it is supposed to (haven't tested it myself),
but qua syntax this seems more correct.

HTH

Met vriendelijke groet/with kind regards,
Ludse Verhoeven

AIX System Engineer
T: +31 10 400 2440
F: +31 10 400 2891
E: ***@vopak.com


Visit / Postal Address:

http://www.vopak.com






Enrico Zimol <***@gmail.com>
19/05/2010 10:43
Please respond to
Nagios Users List <nagios-***@lists.sourceforge.net>


To
Nagios Users List <nagios-***@lists.sourceforge.net>
cc

Subject
Re: [Nagios-users] NRPE with command arguments
Post by Assaf Flatto
after that - change the testing to work the way you want it
Hello, i'm testing that but I can't understand what is wrong on my
configurations.
(blame_nrpe e ricompiling it's ok)
On nrpe.cfg I defined this command:
command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c
$ARG2$


And on nagios server I've this definitions:
http://pastebin.com/7uZRcMk9

Also enabling debug on nrpe deamon I see nothing during the command on
messages:
May 19 08:21:54 blabla xinetd[24320]: START: nrpe pid=24336
from=192.168.234.234
May 19 08:21:54 blabla nrpe[24336]: INFO: SSL/TLS initialized. All
network traffic will be encrypted.
May 19 08:21:54 blabla xinetd[24320]: EXIT: nrpe status=0 pid=24336
duration=0(sec)


Any suggest or documentation?

Thank's!

------------------------------------------------------------------------------

_______________________________________________
Nagios-users mailing list
Nagios-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
Enrico Zimol
2010-05-19 14:44:08 UTC
Permalink
Post by Ludse Verhoeven
Not sure if this works like it is supposed to (haven't tested it myself),
but qua syntax this seems more correct.
That worked fine :)
Other question, where exactly I've to insert quotes on nrpe.cfg commands to
prevent code injection?
I think like this:
[nrpe.cfg]
[...]
command[check_disk]=/usr/local/nagios/libexec/check_disk -w *"*$ARG1$*"* -c
*"*$ARG2$*"*
[...]

Is it right?

Thank's!
--
Enrico "lomiz" Zimol
Ludse Verhoeven
2010-05-19 15:06:57 UTC
Permalink
I think that's fine. It all depends on what you want to pass to the
command itself (in this case the
/usr/locall.nagios/libexec/check_disk-plugin). If f.i. -w "$ARG1$" can use
space-seperated values (which it can't, but just for arguments sake), then
you have to specify (in nrpe.cfg) the (single- or) double-quotes.

Personally I tend not to use quoting in nrpe.cfg since in most cases it is
not necessary, but there might be reasons to explicitly enclose such
arguments in quotes.....

Met vriendelijke groet/with kind regards,
Ludse Verhoeven

AIX System Engineer
T: +31 10 400 2440
F: +31 10 400 2891
E: ***@vopak.com


Visit / Postal Address:

http://www.vopak.com






Enrico Zimol <***@gmail.com>
19/05/2010 16:46
Please respond to
Nagios Users List <nagios-***@lists.sourceforge.net>


To
Nagios Users List <nagios-***@lists.sourceforge.net>
cc

Subject
Re: [Nagios-users] NRPE with command arguments






On 19 May 2010 11:13, Ludse Verhoeven <***@vopak.com> wrote:
Not sure if this works like it is supposed to (haven't tested it myself),
but qua syntax this seems more correct.

That worked fine :)
Other question, where exactly I've to insert quotes on nrpe.cfg commands
to prevent code injection?
I think like this:
[nrpe.cfg]
[...]
command[check_disk]=/usr/local/nagios/libexec/check_disk -w "$ARG1$" -c "
$ARG2$"
[...]

Is it right?

Thank's!
--
Enrico "lomiz" Zimol
------------------------------------------------------------------------------

_______________________________________________
Nagios-users mailing list
Nagios-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
shadih rahman
2010-05-19 19:12:27 UTC
Permalink
try nrpe call "-n" option
I think that's fine. It all depends on what you want to pass to the command
itself (in this case the /usr/locall.nagios/libexec/check_disk-plugin). If
f.i. -w "$ARG1$" can use space-seperated values (which it can't, but just
for arguments sake), then you have to specify (in nrpe.cfg) the (single- or)
double-quotes.
Personally I tend not to use quoting in nrpe.cfg since in most cases it is
not necessary, but there might be reasons to explicitly enclose such
arguments in quotes.....
Met vriendelijke groet/with kind regards,
Ludse Verhoeven
AIX System Engineer
T: +31 10 400 2440
F: +31 10 400 2891
http://www.vopak.com
19/05/2010 16:46
Please respond to
To
cc
Subject
Re: [Nagios-users] NRPE with command arguments
Not sure if this works like it is supposed to (haven't tested it myself),
but qua syntax this seems more correct.
That worked fine :)
Other question, where exactly I've to insert quotes on nrpe.cfg commands to
prevent code injection?
[nrpe.cfg]
[...]
command[check_disk]=/usr/local/nagios/libexec/check_disk -w *"*$ARG1$*"*-c
*"*$ARG2$*"*
[...]
Is it right?
Thank's!
--
Enrico "lomiz" Zimol
------------------------------------------------------------------------------
_______________________________________________
Nagios-users mailing list
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null<https://lists.sourceforge.net/lists/listinfo/nagios-users>
------------------------------------------------------------------------------
_______________________________________________
Nagios-users mailing list
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
--
Cordially,
Shadhin Rahman
Loading...