NRPE - announce - pass arbitrary arguments to nrpe
John Sellens
jsellens at syonex.com
Fri Nov 7 19:47:16 CET 2008
Short version:
A modified NRPE nrpe-2.12s1.tar.gz is now available at
http://www.syonex.com/resources/software.html
Longer version:
I have a want/need to pass arbitrary arguments to nrpe - I want to
be able to invoke plugins via nrpe in the same way as I invoke
plugins locally - essentially just prepend the local plugin invocation
with (more or less) "check_nrpe -H nrpehost -c" and have it work
the same.
I couldn't do it with the standard NRPE because it needs a pre-formatted
string of arguments, doesn't allow shell meta-characters (quite
reasonably), and is hard to deal with arguments containing spaces
or special characters.
For example, consider trying to run check_http via NRPE and checking
for a quoted regular expression in the web page. Difficult to do
with the standard NRPE.
I made a tweak to check_nrpe to stop argument processing after -a
(which I had submitted to the list a while ago), and I've modified
nrpe to make it possible to exec() plugins, rather than invoking
via a shell (via popen()). and to just pass any received arguments
on to the plugin. Avoiding a shell might provide a minor efficiency
improvement.
I added two more options to nrpe.cfg:
- "allow_exec" enables exec()ing plugins rather than popen()ing
- "allow_exec_nasty" which lets you pass nasty shell meta-characters
in plugin arguments
and the exec() behaviour is enabled on a per-plugin basis - if the
plugin command line starts with !, it is exec()d, and any arguments
received from check_nrpe are passed verbatim. (You can't pass arguments
with a ! as that is the arg separator used in the NRPE packets.)
I'll claim that if the plugins are written reasonably (i.e. they
quote their arguments as needed, etc.), this is reaonable behaviour
in lots of environments.
I'd be pleased as punch if my changes were considered for inclusion
in the standard NRPE, but I suspect it might not be a high priority
item. I'm happy to submit a diff/patch.
Hope you might find this useful - feedback/enhancements/questions
are welcomed.
Cheers!
John
--
John Sellens
SYONEX - Systems, Operations, Networks, Expertise
jsellens at syonex.com Suite 14
http://www.syonex.com 320 Harry Walker Pkwy N
tel 905-470-9649 fax 905-470-9649 Newmarket ON L3Y 7B4 Canada
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
More information about the Developers
mailing list