[mrtg] Re: Threshold examples

Scheidel, Greg Greg_Scheidel at ed.gov
Mon Feb 7 17:06:50 MET 2000


Here's a copy of the script that I use on my Linux box to send e-mail when
threshold violations occur.  Note that the parameters passed to this script
do not match those passed in the standard MRTG distribution, but the
principle is the same.  The reason the parameters are not the same is
because I wanted to have more detail in the message sent to me, but didn't
want to have to write a separate script for each interface monitored.  Also,
my mrtg perl script changes allow for a separate script to be run when the
threshold violation occurs, and when the threshold violation is resolved.

Greg S.

---
#!/bin/sh

# Shell script called by MRTG process when an incoming/outgoing threshold
# is crossed.  Sends an e-mail to a list of people notifying them of the
alert.
#
# Parameters:
# $0 - Name of shell script
# $1 - 'Device' - Title[] option in MRTG config file
# $2 - 'Threshold Value' -
ThreshMinI[]/ThreshMaxI[]/ThreshMinO[]/ThreshMaxO[]
#      option in MRTG config file
# $3 - 'Current Value' - current value of input/output that crossed
threshold
# $4 - ThreshLabelI[]/ThreshLabelO[] option in MRTG config file
# $5 - 'Min' or 'Max' text, set directly in the MRTG perl script to identify
#      which threshold was crossed

echo -e "Device          : $1\\nThreshold Type  : $5 $4\\nThreshold Value :
$2\\nCurrent Value   : $3\\nDate/Time       : `date`\\n" | mail -s "MRTG
ALERT : '$1' Passed $5 $4 Threshold" user1 at ed.gov user2 at ed.gov user3 at ed.gov
-----

Greg S.
 
-----Original Message-----
From: Justin Shore [mailto:listuser at vinnie.ksu.ksu.edu]
Sent: Sunday, February 06, 2000 7:57 PM
To: Miller Anthony (RBAU/ISY)
Cc: mrtg at list.ee.ethz.ch
Subject: [mrtg] Re: Threshold examples
Importance: High

Anthony,
        Thanks for the reply.  That looks to be what I want to return
in the e-mail.  I'll have to see if I can find a easy way to do that
in Linux (generic 'mail' can do that I believe--probaly a seperate
script for each Threshold I'm monitoring or at least a seperate text
file to import).  I'm looking at the Thres items in config.html for
MRTG and I'm wondering, is there a way to make it send an e-mail when
it reaches value X, but not send another e-mail for Y minutes
(assuming its still above the threshold and regardless of whether or
not the Threshold was reached during period Y)?  Has anyone done
that?  If MRTG doesn't allow for it, a perl or shell script that
outputs the time to file when run and reads from it when run again
can probably do it.  Interesting idea...  Thanks again!

Justin

At 10:51 AM +1100 2/7/00, Miller Anthony (RBAU/ISY) wrote:
>Justin
>
>Try this....I am using 2.8.3 on an NT box which calls a batch file that
runs
>MAPISEND
>(a command line email util) which fires an email out if the threshold has
>been met
>
>ThreshMaxO[x.x.x.x]: 6000
>ThreshProgO[x.x.x.x]: c:\mrtg-2.8.3\run\ThreshOverWA.bat
>ThreshMaxI[x.x.x.x]: 6000
>ThreshProgI[x.x.x.x]: c:\mrtg-2.8.3\run\ThreshOverWA.bat
>
>ThreshOverWA.bat looks like this
>
>c:\mrtg-2.8.3\run\mapisend.exe -u SENDMAIL -p xxxxxxxx -r "Miller Anthony
>(RBAU/ISY)" -s "Western Australia PVC has exceeded 48K CIR" -m "Click here
>to see graph   file:\\xxxx\mrtg\x.x.x.x.html"
>
>This email tells me which PVC has been met, then places a shortcut to the
>graph in the email so
>you can jump straight to it to see. This monitors both In and Out OIDS.
>Attached is MapiSend
>
>see how you go


--
Justin Shore
K-State Linux Distro Mirror, Sysadmin
macdaddy at vinnie.ksu.ksu.edu
<http://vinnie.ksu.ksu.edu/mirror/rpm2html>
<ftp://vinnie.ksu.ksu.edu/pub/mirror/linux>

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:mrtg-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/mrtg

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:mrtg-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/mrtg



More information about the mrtg mailing list