1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#!@@PERL@@
#
# andrew ryder - atr@mrcoffee.org
# motorola surfboard cablemodems (4100 + 4200 from what I know - most likely
# more since Motorola uses many of the same settings/chipsets across cablemodems
# I know this will not work on Toshiba ones (since they use a different url
# and page
# this is real simple - it goes to your cable modems ip, generally
# 192.168.100.1 and grabs a html file and parses it. I use this to
# see how good my cable connection. good if you have choices in your area
# requires lwp::perl package.
#
# $Log$
# Revision 1.1 2004/01/02 18:50:00 jimmyo
# Renamed occurrances of lrrd -> munin
#
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
# Import of LRRD CVS tree after renaming to Munin
#
# Revision 1.1 2003/11/17 09:29:34 jimmyo
# New plugin surfboard contributed by Andrew Ryder
#
#
#%# family=contrib
use LWP::Simple;
use strict;
my $sb4200_url = "http://192.168.100.1/signaldata.html";
my $url = get($sb4200_url);
my $chunk = undef;
my $snr = undef;
my $powerleveld = undef;
my $powerlevelu = undef;
if ( $ARGV[0] and $ARGV[0] eq "config")
{
print "graph_title Surfboard Statistics\n";
print "graph_order snr downstream upstream\n";
print "graph_vlabel surfboard statistics\n";
print "snr.label SnR\n";
print "snr.draw LINE1\n";
print "downstream.label Power down\n";
print "downstream.draw LINE1\n";
print "upstream.label Power up\n";
print "upstream.draw LINE1\n";
exit 0;
}
while ($url =~ m{>Downstream(.*?)line\.gif}gs) {
$chunk = $1;
$chunk =~ s/\n//gs;
($snr,$powerleveld,$powerlevelu) =
$chunk =~ m{Ratio<\/TD><TD>(.*?)\sdB.*?Power\sLevel<\/TD><TD>(.*?)dBmV.*Power\sLevel<\/TD><TD>(.*?)dBmV}i
or next;
print "snr.ratio $snr\n";
print "downstream.power $powerleveld\n";
print "upstream.power $powerlevelu\n";
}
|