[mrtg] Re: Tips

Daniel J McDonald dmcdonald at digicontech.com
Wed Apr 18 16:31:08 MEST 2001


> I'm trying to use MRTG to send me e-mail when our links lost
> comnection. I've
> already used the option threshprogmin = 0.1% but didn't work
> like I'd like
> because I had received  e-mails all the time even connection
> was OK. So I tried
> the OID ifoperhack with treshprogmin = 1 but I loose
> comunication with one of
> the links and the router interface keeped Up and my hopes
> failed again.
> Does anybody know others ways to get it ?
> Any tips would be grateful !!!

Yes, I ping the router, up to 3 times.  I return to MRTG the number of pings
received and missed.  I then use 3 as my threshold for pings missed before I
fire off an e-mail.

The code is pretty ugly:
#! /usr/bin/perl
use Net::Ping;

$host = $ARGV[0];
    $p = Net::Ping->new("icmp");
if ($p->ping($host)) {
        print "1\n0\n";
        }
else {
# wait 3 seconds and try again.
        sleep 3;
        if ($p->ping($host)) {
        print "1\n1\n";
        }
        else {
#wait 10 seconds and try once more
                        sleep 10;
                        if ($p->ping($host)) {
                                print "1\n2\n";
                                }
                        else {
                                print "0\n3\n";
                        }
        }
}
print "always\n$host\n";
    $p->close();

Daniel J McDonald - CCIE 2495, CNX
Principal Network Specialist
Digicon Technologies
http://www.digicontech.com
dmcdonald at digicontech.com

Digicon - A Cisco Systems Partner, Silver Certified.


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