I think I found a way to fix the problem. At the end of the .bat file where you copy the tmp file to the text file I added a line to delete *.max* . When that file is not found the .bat is run every time the stats are collected. The only other problem I was having is with the if statements in the .bat file. When the first condition fails it doesn't want to test any of the other conditions. I set up a test file that just replaced the the number everytime I ran it. It would create the file but not cycle through. I'm going to try it on the same machine we run MRTG on instead of my workstation.
-----Original Message----- From: Dan Lowry [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 17, 2003 5:46 AM To: Cornwell, Eric J.; [EMAIL PROTECTED] Subject: Re: [mrtg] Re: MRTG Threshold Alerts over Time 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 [EMAIL PROTECTED] 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:[EMAIL PROTECTED] 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