[mrtg] Re: Threshold Examples?

Mike Wren mwren at burnsmcd.com
Thu Jun 10 18:16:40 MEST 2004


 
 
Michael Wren
Senior Network Analyst
Burns & McDonnell Engineering
P.O. Box 419173
Kansas City, MO 64141-6173
816-822-3160
mwren at burnsmcd.com
>>> <chastaib at genco.com> 06/10/2004 9:53:33 AM >>>
>Greetings,
>     I want to use the Threshold Checking parameters in MRTG to allow
me to
>check HDD space and send out an email message if certain parameters
are
>exceeded.
>     Does anyone have some examples of this they can share?
>     I've read through the documentation, but am still not sure how
to
>implement this feature.
>     For example, if I'm monitoring the percent used space on my hard
>drive, do I set up the ThreshMinI variable like:
ThreshMinI[servername]:
>90%
>     Secondly, if I want to call a program, do I used ThreshProgI
like:
>ThreshProgI[servername]: `execute external program`
>Thanks for your help,
>Brian

Here is some information on what I do.  Part of the cfg file from one
of my NetWare servers looks like this:
 
Title[KCOGW2-dsk_DATA]: Disk Space Usage on DATA - 182.2 GB
Target[KCOGW2-dsk_DATA]: `/usr/bin/nwstat.pl kcogw2 vkuDATA zero`
ThreshMaxI[KCOGW2-dsk_DATA]: 95%
SetEnv[KCOGW2-dsk_DATA]: MRTG_HOST="KCOGW2" MRTG_VOLUME="DATA"
ThreshProgI[KCOGW2-dsk_DATA]: /usr/mrtg/thresh/diskspace
ThreshProgOKI[KCOGW2-dsk_DATA]: /usr/mrtg/thresh/diskspaceOK
MaxBytes[KCOGW2-dsk_DATA]: 182233600

The script file diskspace is:
#
DATE=`date`
mail -s "$1 - Volume $MRTG_VOLUME" -b somebody at somewhere << EOF
On $DATE the Disk space used on volume $MRTG_VOLUME was above $2 on
$MRTG_HOST!
EOF

The script file diskspaceOK is:
#
DATE=`date`
mail -s "$1 - Volume $MRTG_VOLUME" -b somebody at somewhere << EOF
On $DATE the Disk space used on volume $MRTG_VOLUME fell below $2
percent on $MRTG_HOST!
EOF

Of course these examples are for a Unix box.  However, for windows the
cfg file would be the same, you would just have to write a batch file to
do the same thing.  I use the SetEnv option to set my own variables to
be used in the script file because it passes all of the target name in
$1 (i.e. KCOGW2-dsk_DATA) not just the host name.  The variable $2 is
the current value, and $3 is the threshold value that it uses.  I have
some other scripts that use all three.  These alerts are usually emailed
to my mailbox and my pager.  That is why I put the DATE in the message,
because sometimes by the time I received the alert an hour or more had
passed.
 


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