Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[Nagiosplug-help] Help with passing Nagios variables to custom plugin

From: Zembower, Kevin <kzembowe(at)jhuccp.org>
Date: Fri Sep 28 2007 - 15:12:56 EDT


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$.

and the plugin fails.

Any suggestions on what I'm doing wrong or overlooking?

Do you need help?X

Thanks for you advice and suggestions.

-Kevin

Kevin Zembower
Internet Services Group manager
Center for Communication Programs
Bloomberg School of Public Health
Johns Hopkins University
111 Market Place, Suite 310
Baltimore, Maryland 21202
410-659-6139



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

Nagiosplug-help mailing list
Nagiosplug-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagiosplug-help ::: Please include plugins version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null Received on Fri Sep 28 15:13:16 2007

This archive was generated by hypermail 2.1.8 : Mon Oct 08 2007 - 18:06:15 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library