2012-08-07 07:16:31 +02:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
# (C) Alex Dekker <me@ale.cx>
|
|
|
|
# License is GPL
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my ($Args) = @ARGV;
|
|
|
|
|
2013-04-06 17:39:01 +02:00
|
|
|
my $expecter = "/path/to/beboxstats.expect";
|
2012-08-07 07:16:31 +02:00
|
|
|
|
|
|
|
if ($Args) {
|
|
|
|
|
|
|
|
# work out line to grab
|
|
|
|
if ($Args eq 'autoconf') {
|
|
|
|
# Check the expect script that polls the router exists
|
|
|
|
unless ( -e $expecter ) {
|
|
|
|
print "no (Can't find expect script. Check value of \$expecter: $expecter)\n";
|
|
|
|
} else {
|
|
|
|
print "yes\n";
|
|
|
|
}
|
|
|
|
} elsif ($Args eq 'config') { # print out plugin parameters
|
|
|
|
printf("
|
|
|
|
graph_title bebox sync stats
|
|
|
|
graph_vlabel ATM kbps
|
2013-04-06 17:39:01 +02:00
|
|
|
graph_category network
|
2012-08-07 07:16:31 +02:00
|
|
|
graph_info This graph shows line sync speed
|
|
|
|
syncdownstream.label Downstream Sync Speed
|
|
|
|
syncupstream.label Upstream Sync Speed
|
|
|
|
syncdownstream.type GAUGE
|
|
|
|
syncupstream.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(' ', `$expecter | grep stream`);
|
|
|
|
|
2013-04-06 17:39:01 +02:00
|
|
|
print "syncdownstream.value $insplitted[3]\n";
|
|
|
|
print "syncupstream.value $insplitted[7]\n";
|
2012-08-07 07:16:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|