problem with %ENV and macros in event handler

Louis Munro louis.munro at gmail.com
Wed May 14 17:57:00 CEST 2008


Hello All,
I'm writing an event handler in perl for nagios 2.6 and I can't seem to
be able to access the macros as exported to the environment by using %ENV.

I've enabled logging and I can see the script (env_output) being run as
in these two lines:
[1210710038] SERVICE ALERT: clone;SMTP;OK;HARD;3;SMTP OK - 0.148 sec.
response time
[1210710038] SERVICE EVENT HANDLER: clone;SMTP;OK;HARD;3;env_output

The script itself is very simple as it is only a debugging tool:

#!/usr/bin/perl -w
use use Data::Dumper;
use strict;

open(ENV,">","/var/log/nagios/env.dump");
print ENV Dumper(\%ENV);
close ENV;

[end of script]


Here is the output:
$VAR1 = {
           'SHLVL' => '2',
           'PWD' => '/',
           'TERM' => 'xterm',
           '_' => '/usr/sbin/nagios',
           'LANG' => 'en_US',
           'PATH' => '/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin'
         };

So no NAGIOS_* => anything.

What am I missing?
Thank you for your help.

Louis


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/




More information about the Developers mailing list