[mrtg] Re: MRTG Threshold Alerts over Time

Dan Lowry dan.lowry at attbi.com
Tue Jun 17 11:46:21 MEST 2003


Hello Eric,

It seems that the reason that ThreshDir has to be defined is that MRTG needs
this in order to create the temporary file that it uses in order to run
ThreshOK. Without it, I don't think that ThreshOK will run. Unfortunately,
once ThreshDir is defined, the thresh_over script won't run every 5 minutes.
I think it has something to do with the fact that MRTG will only send an
alert once per hour. (In this case we need it to send the alert every five
minutes). If you add a line in the batch file to delete the threshok
temporary file , that defeats the purpose, since MRTG needs the file in
order to run ThreshOK. (If anyone has a workaround to this, please let me
know.

    Here's an updated version of the batch file that seems to work.Sends an
email every 15 minutes when CPU over threshold, but has no way of resetting
if the variable is left as 1,2, or 3, and the threshold goes back to normal,
next time it's kicked off, you'll get a premature email, based on in  what
state the variable was left.
Dan

:sendmail_cpu_util_after_15min.bat
echo off
if exist e:\mrtg\thresholds\%1.txt goto skip
echo 0 >e:\mrtg\thresholds\%1.txt
:skip
for /f %%a in (e:\mrtg\thresholds\%1.txt) do (
if "%%a"=="2" ECHO Current %THRESH_DESC% is %3 Percent. >
e:\mrtg\thresholds\cpu_util.txt
if "%%a"=="2" ECHO Utilization has been Greater Than %2 Percent for the last
15 Minutes >> e:\mrtg\thresholds\cpu_util.txt
if "%%a"=="2" ECHO Please call Network Support On-Call >>
e:\mrtg\thresholds\cpu_util.txt
if "%%a"=="2" ECHO Next EMAIL will be in 15 Minutes if problem persists. >>
e:\mrtg\thresholds\cpu_util.txt
if "%%a"=="2" e:\mrtg\sendmail\blat.exe e:\mrtg\thresholds\cpu_util.txt -s
"%THRESH_DESC% has been greater than %2 Percent for the last 15 minutes!" -t
bozo at clown.com
if "%%a"=="2" del e:\mrtg\thresholds\cpu_util.txt
if "%%a"=="2" echo 0 >e:\mrtg\thresholds\%1.tmp
if "%%a"=="1" echo 2 >e:\mrtg\thresholds\%1.tmp
if "%%a"=="0" echo 1 >e:\mrtg\thresholds\%1.tmp
)
copy e:\mrtg\thresholds\%1.tmp e:\mrtg\thresholds\%1.txt





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