[mrtg] Threshold problem

Adam Bayless adam at baylessfamily.org
Wed Oct 24 17:45:22 CEST 2007


So MRTG has stumped me for the first time in a long while :( It's not calling the 
threshold program I've got defined for just one of my targets. I can't figure out 
what I've done wrong. The threshold program runs fine if I run it separately and MRTG 
is logging values that break the threshold, but it is not calling the program.

It's pulling electric current values from a UPS and the only part that's not working 
is the threshold. The graphs and html are all getting created perfectly. I must be 
missing something obvious here. HELP??

-adam



Here's the relevant info:

MRTG Version
------------------------------
mrtg-2.15.2


Config Snippet
------------------------------
WorkDir: /mrtg/www/docs/backbone/fbp/dataCenterPower/ups2/ups
WriteExpires: Yes

Target[outputAmpsLeg1]: upsOutputCurrent.1&upsOutputCurrent.1:XXX at XXXXXX:
Title[outputAmpsLeg1]: Output Amps * 10 - Leg 1
MaxBytes[outputAmpsLeg1]: 1400
AbsMax[outputAmpsLeg1]: 5000
Options[outputAmpsLeg1]: gauge,expscale
WithPeak[outputAmpsLeg1]: dwmy
YLegend[outputAmpsLeg1]: AMPS * 10
ShortLegend[outputAmpsLeg1]: amps * 10
ThreshMaxI[outputAmpsLeg1]: 700
ThreshProgI[outputAmpsLeg1]: /mrtg/bin/threshold-programs/customer-amps-alert.pl
SetEnv[outputAmpsLeg1]: MAILTO="adam at baylessfamily.org" CIRCUIT="UPS2 Leg 1" 
MULTIPLIER="10"
PageTop[outputAmpsLeg1]: <h1>Output Amps * 10 -  Leg 1</h1>


Top of outputAmpsLeg1.log
-------------------------------
1193168346 880 880
1193168346 880 880 880 880
1193168294 900 900 900 900
1193168100 895 895 900 900
1193167800 897 897 910 910
1193167500 896 896 910 910
1193167200 898 898 910 910
1193166900 900 900 910 910


debug for 'mrtg ups2.cfg'
--------------------------------
--base: Act on Router/Target outputampsleg1
--base: Get Current values: in:880, out:880, up:84 days, 2:37:12, name:UPS-2, 
time:1193168346
--base: Create Graphics
--log: /usr/local/bin/rateup /mrtg/www/docs/backbone/fbp/dataCenterPower/ups2/ups/ 
outputampsleg1 1193168346 -Z g 880 880 5000 c #00cc00 #0000ff #006600 #ff00ff -x l 
[AMPS * 10] k 1000 i 
/mrtg/www/docs/backbone/fbp/dataCenterPower/ups2/ups/outputampsleg1-day.png -1400 
-1400 400 100 1 1 0 300 0 4 1 %Y-%m-%d %H:%M 0
--base: Check for Thresholds
--base: Check for Write HTML Pages



/mrtg/bin/threshold-programs/customer-amps-alert.pl
---------------------------------
#!/usr/bin/perl

$router = $ARGV[0];
$thresh = $ARGV[1];
$current = $ARGV[2];

if ($ENV{MULTIPLIER} eq "")
{
         $ENV{MULTIPLIER} = 1;
}
open(MAIL,"|/usr/sbin/sendmail $ENV{MAILTO}");
print MAIL "Amps on $ENV{CIRCUIT} is at " . sprintf("%d",$current / $ENV{MULTIPLIER})
         . ". Threshold is " . sprintf("%d",$thresh / $ENV{MULTIPLIER}) . " \n\n"; 

close(MAIL);
exit;



More information about the mrtg mailing list