root / plugins / router / beboxstats @ 4b2fcbf8
Historique | Voir | Annoter | Télécharger (1,87 ko)
| 1 |
#!/usr/bin/perl -w |
|---|---|
| 2 |
|
| 3 |
use strict; |
| 4 |
|
| 5 |
my ($Args) = @ARGV; |
| 6 |
|
| 7 |
my $expecter = "/path/to/beboxstats.expect"; |
| 8 |
|
| 9 |
if ($Args) {
|
| 10 |
|
| 11 |
# work out line to grab |
| 12 |
if ($Args eq 'autoconf') {
|
| 13 |
# Check the expect script that polls the router exists |
| 14 |
unless ( -e $expecter ) {
|
| 15 |
print "no (Can't find expect script. Check value of \$expecter: $expecter)\n"; |
| 16 |
} else {
|
| 17 |
print "yes\n"; |
| 18 |
} |
| 19 |
|
| 20 |
} elsif ($Args eq 'config') { # print out plugin parameters
|
| 21 |
printf("
|
| 22 |
graph_title bebox line stats |
| 23 |
graph_vlabel deciBels |
| 24 |
graph_category network |
| 25 |
graph_info This graph shows the various line parameters |
| 26 |
attenuationdownstream.label Downstream Attenuation |
| 27 |
attenuationupstream.label Upstream Attenuation |
| 28 |
margindownstream.label Downstream Noise Margin |
| 29 |
marginupstream.label Upstream Noise Margin |
| 30 |
outputpowerdownstream.label Downstream Output Power |
| 31 |
outputpowerupstream.label Upstream Output Power |
| 32 |
margindownstream.type GAUGE |
| 33 |
outputpowerupstream.type GAUGE |
| 34 |
attenuationdownstream.type GAUGE |
| 35 |
marginupstream.type GAUGE |
| 36 |
outputpowerdownstream.type GAUGE |
| 37 |
attenuationupstream.type GAUGE |
| 38 |
"); |
| 39 |
# .label is the Key on the graph |
| 40 |
} else {
|
| 41 |
printf("Usage: $0
|
| 42 |
No arguments: print line stats |
| 43 |
autoconf: print 'yes' |
| 44 |
config: print config info for Munin\n"); |
| 45 |
} |
| 46 |
|
| 47 |
} else {
|
| 48 |
# if no arguments, just fetch the data and print it out |
| 49 |
|
| 50 |
my @insplitted = split(' ', `$expecter | grep dB`);
|
| 51 |
|
| 52 |
print "margindownstream.value $insplitted[3]\n"; |
| 53 |
print "marginupstream.value $insplitted[4]\n"; |
| 54 |
|
| 55 |
print "attenuationdownstream.value $insplitted[8]\n"; |
| 56 |
print "attenuationupstream.value $insplitted[9]\n"; |
| 57 |
|
| 58 |
print "outputpowerdownstream.value $insplitted[13]\n"; |
| 59 |
print "outputpowerupstream.value $insplitted[14]\n"; |
| 60 |
} |
| 61 |
|
| 62 |
|
