[Nagiosplug-help] Help with passing Nagios variables to customplugin
Ralph.Grothe at itdz-berlin.de
Ralph.Grothe at itdz-berlin.de
Mon Oct 1 11:28:48 CEST 2007
Hi Kevin,
> -----Original Message-----
> From: nagiosplug-help-bounces at lists.sourceforge.net
> [mailto:nagiosplug-help-bounces at lists.sourceforge.net]On Behalf
Of
> Zembower, Kevin
> Sent: Friday, September 28, 2007 9:13 PM
> To: nagiosplug-help at lists.sourceforge.net
> Subject: [Nagiosplug-help] Help with passing Nagios variables
to
> customplugin
>
>
> Following advice from a user here, I used this code to dump
> the contents
> of the NAGIOS_* variables to a file when the perl plugin I
wrote was
> called:
>
> # Use this line below to dump the environment variables for
debugging
> system "env|sort >/tmp/plugins_env.$$";
>
> This seems to work correctly, and I end up with:
> ...
> NAGIOS_HOSTADDRESS=10.253.192.204
> NAGIOS_HOSTALIAS=www.jhuccp.org
> ...
>
> which is exactly what I expected. Then I tried to use this
value with:
> my %NAGIOS_ENV = map { $_ => $ENV{$_} } grep /^NAGIOS_/, keys
%ENV;
> ...
> } elsif (defined($NAGIOS_ENV{NAGIOS_HOSTADDRESS})) {
> $hostaddress = $NAGIOS_ENV{NAGIOS_HOSTADDRESS};
> ...
> print DMP "hostaddress is $hostaddress.\n";
>
> This outputs:
> hostaddress is $HOSTADDRES$.
is this just a typo (one missing S of the macro name)?
What does your check command definition look like?
More information about the Help
mailing list