[mrtg] Re: Treshold alarm

Zaid Ali zaid at activetouch.com
Mon Aug 30 21:45:37 MEST 1999


I have this running via MRTG for my network monitoring System. I believe
there is some correspondence on this list regarding this matter so
perhaps you can search the archive. Here is the basic outline anyway. :

In your CFG file you should have this :

ThreshMaxI[xxxx]: 75  # Threshold Value
ThreshProgI[xxxx]:/path/perl script for notification #the path to your
perl script for email notification.

Here is the perl script for email notification :

#!/usr/bin/perl
my($timestr, $param, $thresh, $value, $abovebelow, $message);
$timestr = localtime(time);
$param = $ARGV[0];
$thresh = $ARGV[1];
$value = $ARGV[2];
if ($thresh > $value) { $abovebelow = "below"; }
else { $abovebelow = "above"; }
$message .= "$timestr $param is experiencing $value% CPU Consumption
$abovebelow a threshold of $thresh%";
my $logfile = "/tmp/thresh.log";  # Log to file
my $emailprog = "/bin/mail -s 'MRTG Thresh (CPU Usage)'"; # Send email
my $emailuser1 = "user1\@domain.com";
my $emailuser2 = "user2\@domain.com";
# Log it.
open(LOG, ">>$logfile");
print LOG "$message\n";
close(LOG);

# Email it.
system("echo '$message' | $emailprog $emailuser1 $emailuser2 ");

exit(0);
stop; 


You can customize this email script any way you want. 

Hope this helps.

Regards
Zaid
------------------------------------------
Zaid Ali
Network Engineer
Active Touch, Inc
5225 Betsy Ross Drive
Santa Clara, CA  95054
Tel: 408-980-5200 x 2144
fax: 408-980-5280
www.activetouch.com
www.webex.com
----------------------------------------



-----Original Message-----
From: niclas.soderlund at nvso.sll.se [mailto:niclas.soderlund at nvso.sll.se]
Sent: Monday, August 30, 1999 7:27 AM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] Treshold alarm



I was wondering if anyone out there has som kind of "alarm" connected to
their
MRTG installation today? With alarm i mean for example if someone has
manipulated their mrtg code so that if any interface has a procentage
above 70%
it sends a mail to an administrator or such.. Since im far from a coder,
even
though not entirely out in the bushes - I cant seem to find where to put
that
sort of code in..if possible at all. But I imagine those numbers popping
up
somewhere while calculating them, and thereabouts being able to put some
more
code wich will make a simple if (>70) then mail or similar..

Anyone?

TIA,

Niclas
 _ _ _ _ _
|_|_|_|_|_| Niclas Söderlund
|_|_|_|_|_| Nätverksansvarig, NVSO
|_|_|_|_|_| Stockholms Läns Landsting
|_|_|_|_|_| http://www.soderlund.org - http://www.sll.se
|_|_|_|_|_| niclas at soderlund.org - niclas.soderlund at nvso.sll.se

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg


More information about the mrtg mailing list