BeBox router line stats gatherer for Munin
or any other graphing package, for that matter
Sample output:
$ /etc/munin/plugins/bebox_linestats
margindownstream.value 6.0
marginupstream.value 7.0
attenuationdownstream.value 26.5
attenuationupstream.value 12.0
outputpowerdownstream.value 19.0
outputpowerupstream.value 12.0
#!/usr/bin/expect -f
# script to log on to a BeBox router [ST Speedtouch 780] and gather line stats
# set timeout for response from router to 30 seconds
set timeout 30
set router "192.168.1.254"
set port "23"
set username "Administrator"
set password ""
# telnet to $router on $port
spawn telnet $router $port
expect "Username :"
send "$username\r"
expect "Password :"
send "$username\r"
expect "}=>"
send "adsl info\r"
expect "}=>"
send "exit\r"
#!/usr/bin/perl -W
# puts the output of beboxstats.expect in a form that Munin can use.
use strict;
my ($Args) = @ARGV;
if ($Args) {
# work out line to grab
if ($Args eq 'autoconf') {
# just say 'yes' to autoconf - I can't think of a sensible way
# of ascertaining if it's going to work
print "yes\n";
} elsif ($Args eq 'config') { # print out plugin parameters
printf("
graph_title bebox line stats
graph_vlabel deciBels
graph_category other
graph_info This graph shows the various line parameters
attenuationdownstream.label Downstream Attenuation
attenuationupstream.label Upstream Attenuation
margindownstream.label Downstream Noise Margin
marginupstream.label Upstream Noise Margin
outputpowerdownstream.label Downstream Output Power
outputpowerupstream.label Upstream Output Power
margindownstream.type GAUGE
outputpowerupstream.type GAUGE
attenuationdownstream.type GAUGE
marginupstream.type GAUGE
outputpowerdownstream.type GAUGE
attenuationupstream.type GAUGE
");
# .label is the Key on the graph
} else {
printf("Usage: $0
No arguments: print line stats
autoconf: print 'yes'
config: print config info for Munin\n");
}
} else {
# if no arguments, just fetch the data and print it out
my @insplitted = split(' ', `/path/to/beboxstats.expect| grep dB`);
print "margindownstream.value $insplitted[3]\n";
print "marginupstream.value $insplitted[4]\n";
print "attenuationdownstream.value $insplitted[8]\n";
print "attenuationupstream.value $insplitted[9]\n";
print "outputpowerdownstream.value $insplitted[13]\n";
print "outputpowerupstream.value $insplitted[14]\n";
}