[mrtg] Re: Threshold programs problem

Anson Rinesmith arinesmith at bigrivertelephone.com
Tue Oct 24 19:09:22 MEST 2006


Granted that perl is not my forte, but I don't see where you are dropping
those values out to your logfile. I put our exact code into my server and
got good results.

$ more test.pl
#!C:\perl\bin\perl.exe -w

use strict;

my $router = $ARGV[0];
my $threshold = $ARGV[1];
my $current_value = $ARGV[2];

print "router $router threshold $threshold current_value $current_value \n";


OUTPUT
$ perl ./test.pl router 10 20
router router threshold 10 current_value 20


-----Original Message-----
From: mrtg-bounce at list.ee.ethz.ch [mailto:mrtg-bounce at list.ee.ethz.ch] On
Behalf Of mrtglist at keithbergen.com
Sent: Tuesday, October 24, 2006 11:49 AM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] Re: Threshold programs problem

Thanks Steve for the "THRESH_DESC" explanation. Upon re-reading the config
documentation, it was very plainly stated (my bad!).

Does anybody have an idea why my program isn't seeing the $router,
$threshold, $current_value parameters?

Keith.

-----Original Message-----
From: mrtg-bounce at list.ee.ethz.ch [mailto:mrtg-bounce at list.ee.ethz.ch] On
Behalf Of mrtglist at keithbergen.com
Sent: Monday, October 23, 2006 9:10 PM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] Threshold programs problem


All,

I apologize if this has been discussed before, I'm a first-time subscriber
to this list. I have read the documentation up and down as well as many web
searches, and still can't figure out what I'm doing wrong.

I am using MRTG 2.14.7. It is monitoring a folder to see how many files are
in that folder. If the number exceed a threshold value, then I want an email
to go out.

I wrote the Perl script (Active State 5.8.8). That is supposed to take the
parameters passed by ThreshProgI. It seems that the MRTG program is not
passing the parameters (or is not passing them the way I would expect. It
also does not appear to be setting the "ThreshDesc" environment variable.

Here is a snip of my Perl script. Note that when I run the script from the
command line as "perl script param 10 200", it works fine. When the script
runs from MRTG, it doesn't have any of the parameters.

Script:
#!C:\perl\bin\perl.exe -w

use strict;
use Mail::Sendmail;

my $router = $ARGV[0];
my $threshold = $ARGV[1];
my $current_value = $ARGV[2];
my $logfile = "c:\\mrtg\\RCD\\notify.log";
my $description = $ENV{'ThreshDesc'};
my $timestamp = localtime();
my %mail;
# at this point, $router $threshold $current_value and $description are
empty.


Relevant MRTG Config Parameters:
ThreshDir: \\server\folder\DPC\Folder_Monitor\logs
ThreshMaxI[fld_cnt]: 10
ThreshProgI[fld_cnt]: c:\mrtg\RCD\notifyBAD.pl
ThreshProgOKI[fld_cnt]: c:\mrtg\RCD\notifyOK.pl

What am I doing wrong?

Keith.

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

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



More information about the mrtg mailing list