[Nagios-devel] $0 under ePN
-
Guest
[Nagios-devel] $0 under ePN
--BXVAT5kNtrzKuDFl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
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
--BXVAT5kNtrzKuDFl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="p1-nagios-plugin-env.diff"
--- 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' ;
# >>
$sub
--BXVAT5kNtrzKuDFl--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]