$0 under ePN

Gavin Carr gavin at openfusion.com.au
Mon Aug 21 06:48:19 CEST 2006


Hi all,

Under ePN $0 contains the full path to the ePN interpreter (e.g. 
/usr/local/bin/p1.pl) instead of the path to the currently running
plugin. This makes it difficult for plugins that want to determine
how they were invoked in order to present different personalities.

I can think of two possible solutions:

1. modify nagios to set an environment variable before it invokes 
   the plugin (or ePN) containing the full path to the plugin
   e.g. NAGIOS_PLUGIN or some such

2. workaround the issue in p1.pl for ePN only (see e.g. the attached 
   one-line patch to p1.pl)

1) is probably the better solution, but I'm not sure how much work it
would be. 2) is pretty trivial, but requires perl plugins to be aware
of the issue and explicitly code for it (though we could support in
the Nagios::Plugins library fine).

Thoughts?

Cheers,
Gavin

-- 
Gavin Carr
Open Fusion - Open Source Business Solutions [ Linux - Perl - Apache ]
http://www.openfusion.com.au
- Fashion is a variable, but style is a constant - Programming Perl
-------------- next part --------------
--- p1-dist.pl	2006-08-11 15:47:25.000000000 +1000
+++ p1.pl	2006-08-21 14:03:57.000000000 +1000
@@ -188,6 +188,7 @@
 sub hndlr {
 	\@ARGV = \@_ ;
 	local \$^W = 1 ;
+ 	\$ENV{NAGIOS_PLUGIN} = '$filename' ;
 
 								# <<< START of PLUGIN (first line of plugin is line 8 in the text) >>>
 $sub
-------------- next part --------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list