[mrtg] Re: Threshold programs problem

mrtglist at keithbergen.com mrtglist at keithbergen.com
Sat Nov 11 00:17:59 MET 2006


Well, I figured it out. Under windows, you set an association of *.pl to
c:\perl\bin\perl.exe. When that is set, windows doesn't seem to accept the
passed parameters. I'm sure that MRTG is passing those parameters. The
solution is to have a *.bat file that passes them.

ThreshProgI[monitor]: c:\mrtg\myprogs\bad.bat

Bad.bat contains:
@c:\perl\bin\perl.exe c:\mrtg\myprogs\bad.bat %1 %2 %3

It all seems fine using that.

-----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: Wednesday, October 25, 2006 9:53 PM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] Re: Threshold programs problem


I didn't paste my entire script, only the part where I assign the values. I
do have a print statement something like the one you included.

Here's the kicker. When I run the script from the Dos command line, it works
fine. When MRTG calls it, it doesn't set the three parameters.

Keith.

-----Original Message-----
From: Anson Rinesmith [mailto:arinesmith at bigrivertelephone.com] 
Sent: Tuesday, October 24, 2006 1:09 PM
To: mrtglist at keithbergen.com; mrtg at list.ee.ethz.ch
Subject: RE: [mrtg] Re: Threshold programs problem


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


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