Adam Bayless thought no one was listening and belted out:
> 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:[EMAIL 
> PROTECTED]:
> 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="[EMAIL PROTECTED]" CIRCUIT="UPS2 Leg 1" 
> MULTIPLIER="10"
> PageTop[outputAmpsLeg1]: <h1>Output Amps * 10 -  Leg 1</h1>
> 
> 

snip

Here's a bit more info on the problem. I went into the source code and found 
that my 
config is not making it past the conditionals in this section (starts at line 
1923 in 
mrtg):


-------------------------------------------------------------------------------
                   # Check if we use the status file or not...
                   if ( defined $threshfile ) {
                     if ( not -e $threshfile.".".$bound.uc($dir) ) {
                         # Create a file to indicate a threshold problem for 
the time 
after the problem
                         open THRESHTOUCH, ">".$threshfile.".".$bound.uc($dir)
                             or warn "$NOW: WARNING: Creating 
$threshfile.".$bound.uc($dir).": $!\n";
                         close THRESHTOUCH;
                         if (defined $$rcfg{'threshprog'.$dir}{$router}){
                              debug('base',"run threshprog$dir: ".(join 
",",@exec));
                              system @exec;
                         }
                         threshmail 
$cfg->{threshmailserver},$cfg->{threshmailsender},$rcfg->{threshmailaddress}{$router},$message
                            if $rcfg->{threshmailaddress}{$router}

                     } else {
                         debug('base',"NOT acting on BROKEN threshold since 
$threshfile.$bound$dir exists");
                     }
                   } elsif ( not defined $cfg->{threshhyst} or
                             ($bound eq 'min' and $boundval - 
$cfg->{threshhyst}* 
$boundval < $threshval) or
                             ($bound eq 'max' and $boundval + 
$cfg->{threshhyst}* 
$boundval > $threshval)
                           ) {
                      # no threshold dir so run on every 'break'
                      if (defined $$rcfg{'threshprog'.$dir}{$router}){
                              debug('base',"run threshprog$dir: ".(join 
",",@exec));
                              system @exec;
                      }
                      threshmail 
$cfg->{threshmailserver},$cfg->{threshmailsender},$rcfg->{threshmailaddress}{$router},$message
                            if $rcfg->{threshmailaddress}{$router};
                   }


-------------------------------------------------------------------------------



If I tack on a little more code then I get the behavior I expect:



-------------------------------------------------------------------------------

                   else {
                      if (defined $$rcfg{'threshprog'.$dir}{$router}){
                              debug('base',"hack run threshprog$dir: ".(join 
",",@exec));
                              system @exec;
                      }
                   }

-------------------------------------------------------------------------------


What I can't figure out is why my config doesn't meet this criteria:


-------------------------------------------------------------------------------
                   } elsif ( not defined $cfg->{threshhyst} or
                             ($bound eq 'min' and $boundval - 
$cfg->{threshhyst}* 
$boundval < $threshval) or
                             ($bound eq 'max' and $boundval + 
$cfg->{threshhyst}* 
$boundval > $threshval)
                           ) {
-------------------------------------------------------------------------------


I don't have threshhyst defined in the config file so that if should evaluate 
to 
true!! As far as I can find in the code there is no global definition for 
threshhyst 
that would override the fact that I haven't defined it in my config file.

Anyone have any ideas?

_______________________________________________
mrtg mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg

Reply via email to