[mrtg] Re: Question about SetEnv

Starkweather, Mike mike.starkweather at anheuser-busch.com
Fri Apr 5 22:35:19 MEST 2002


I don't mess with Unix much, but I think you have to use the %ENV hash to get at
environment variables.  Change the $EMAIL line to something like:

$x = $ENV{'EMAIL'}; printf "$x\n";

Mike Starkweather

-----Original Message-----
From: Max Kipness II [mailto:mkipness at aztechsolutions.com]
Sent: Friday, April 05, 2002 2:31 PM
To: MRTG Mailinglist
Subject: [mrtg] Question about SetEnv


Hello,
 
I'm trying to create a perl script that emails admins based on some data
sent via SetEnv. I'm getting the first three built in variables passed
to the script, but nothing else. When I had done the same thing with a
Bash script, however, I got every variable that was set with SetEnv. Am
I missing something? Here is what I'm doing:
 
SetEnv[httplat-steelecreek-b]: EMAIL="email at email.com
<mailto:email at email.com> "
ThreshProgI[httplat-steelecreek-b]: /etc/mrtg/thresh/test
 
Here is the contents of /etc/mrtg/thresh/test
 
#!/usr/bin/perl
printf "@ARGV[0]\n";
printf "@ARGV[1]\n";
printf "@ARGV[2]\n";
printf "$EMAIL\n";
Here is what gets printed out (and emailed to me via a cron error):

httplat-cwxts-b
4
66

Why is the $EMAIL variable not passing to the perl script? Is there
something else I need to do in Perl?

-Max

 

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list