[mrtg] improved dhcp script

Eric Garnel egarnel3470 at yahoo.com
Wed Jun 25 23:59:47 MEST 2003


I improved the dhcp script I wrote a while back for MRTG. It is now
only a single perl script and runs faster. Still requires fping. 

#!/usr/bin/perl
#
#Author: Eric Garnel
#Date: June 25, 2003
# located on http://www.garnel.com/mrtg/
#Rev: 1.5
#
#       dhcp script for MRTG
#       shows how many hosts are up and which are down
#       shows how many hosts are up and which are down
#       requires fping
##########################################################
# snipped GPL verbage
###############################################################
#
#       instructions
# change the ip addresses below to suite your dhcp scope
# adjust path for fping location
# call from MRTG Config
#
$alive = `/usr/sbin/fping -ga 127.14.29.30 127.14.29.250 | wc -l`;
$alive =~ s/ +//;

chop($alive);

$alive--;

print("$alive\n");
#
# now show who is not up
#
$dead = `/usr/sbin/fping -gu 127.14.29.30 127.14.29.250 | wc -l`;
$dead =~ s/ +//;

chop($dead);

$dead--;

print("$dead\n");
print "0\n";
print "0\n";
 

=====

Eric Garnel CCNP, MCSE



eric at garnel.com

 

 

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