mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 02:18:08 +00:00
Merge pull request #687 from smith153/master
Fix plugins: QOS, modem-nvg510 and weather/temperature_
This commit is contained in:
commit
1e4e61941c
9 changed files with 51 additions and 47 deletions
|
@ -28,30 +28,30 @@ use HTTP::Tiny;
|
|||
|
||||
|
||||
use constant {
|
||||
down_rate => 0,
|
||||
up_rate => 1,
|
||||
sn_down => 14,
|
||||
sn_up => 15,
|
||||
line_attn_down => 16,
|
||||
line_attn_up => 17,
|
||||
power_down => 18,
|
||||
power_up => 19,
|
||||
err_sec_down => 20,
|
||||
err_sec_up => 21,
|
||||
los_down => 22,
|
||||
los_up => 23,
|
||||
lof_down => 24,
|
||||
lof_up => 25,
|
||||
fec_down => 26,
|
||||
fec_up => 27,
|
||||
crc_down => 28,
|
||||
crc_up => 29,
|
||||
down_rate => 2,
|
||||
up_rate => 3,
|
||||
sn_down => 23,
|
||||
sn_up => 24,
|
||||
line_attn_down => 25,
|
||||
line_attn_up => 26,
|
||||
power_down => 27,
|
||||
power_up => 28,
|
||||
err_sec_down => 29,
|
||||
err_sec_up => 30,
|
||||
los_down => 31,
|
||||
los_up => 32,
|
||||
lof_down => 33,
|
||||
lof_up => 34,
|
||||
fec_down => 35,
|
||||
fec_up => 36,
|
||||
crc_down => 37,
|
||||
crc_up => 38,
|
||||
};
|
||||
|
||||
|
||||
if(defined $ARGV[0] and $ARGV[0] eq 'autoconf'){
|
||||
my $url = $ENV{url} || "http://192.168.1.254/cgi-bin/dslstatistics.ha";
|
||||
my $html = HTTP::Tiny->new(timeout => 1 )->get($url);
|
||||
my $html = HTTP::Tiny->new(timeout => 30 )->get($url);
|
||||
|
||||
if($html->{success} && $html->{content} =~ m{Broadband Status}){
|
||||
print "yes\n";
|
||||
|
@ -159,10 +159,11 @@ lof_up.min 0
|
|||
########################## MAIN #############################
|
||||
|
||||
my $url = $ENV{url} || "http://192.168.1.254/cgi-bin/dslstatistics.ha";
|
||||
my $html = HTTP::Tiny->new(timeout => 1 )->get($url);
|
||||
my $html = HTTP::Tiny->new(timeout => 30 )->get($url);
|
||||
die "Couldn't fetch $url" unless $html->{success};
|
||||
my @stats = $html->{content} =~ m{<td class="col2">\s*([\d\.]+)\s*</td>}g;
|
||||
my @stats = $html->{content} =~ m{<td class="col2">(.*?)</td>}sg;
|
||||
|
||||
chomp(@stats);
|
||||
|
||||
print qq|multigraph nvg510_speed
|
||||
down_rate.value $stats[down_rate]
|
||||
|
|
|
@ -81,7 +81,7 @@ my( $name, $id1, $id2, $type, $rate, $parent);
|
|||
for( my $x = 0; $x < scalar(@class); $x++ ) {
|
||||
if($class[$x] =~ m/^class/i ) {
|
||||
( $name, $id1, $id2, $type, $parent) = ( $class[$x] =~ m/^class\s+(\w+)\s+(\d+):(\d+)\s+(\w+)\s([^\s]+)/i );
|
||||
if($type eq "parent") {
|
||||
if($type && $type eq "parent") {
|
||||
$x++;
|
||||
( $rate ) = ( $class[$x] =~ m/Sent\s+(\d+)\s+/i );
|
||||
$handle = "$name"."${id1}_${id2}";
|
||||
|
@ -106,6 +106,8 @@ if ( exists $ARGV[0] and $ARGV[0] eq 'config' ) {
|
|||
print "graph_data_size $ENV{graph_data_size}\n" if $ENV{graph_data_size};
|
||||
print "graph_order ";
|
||||
foreach my $key (sort by_handle keys %queues) {
|
||||
delete $queues{$key} if $key =~ /sfq/i;
|
||||
next if $key =~ /sfq/i;
|
||||
$haschild = 0;
|
||||
foreach my $key2 (sort by_handle keys %queues) {
|
||||
if($queues{$key}->{id} eq $queues{$key2}->{parent}) {
|
||||
|
@ -136,7 +138,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq 'config' ) {
|
|||
} elsif (exists $ENV{"max$queues{$key}->{handle}"}) {
|
||||
print $queues{$key}->{queue},$queues{$key}->{handle}, ".max ",$ENV{"max$queues{$key}->{handle}"},"\n";
|
||||
}
|
||||
print $queues{$key}->{queue},$queues{$key}->{handle}, ".type COUNTER\n";
|
||||
print $queues{$key}->{queue},$queues{$key}->{handle}, ".type DERIVE\n";
|
||||
if($count == 0){
|
||||
print $queues{$key}->{queue},$queues{$key}->{handle}, ".draw AREA\n";
|
||||
} else {
|
||||
|
@ -157,6 +159,7 @@ sub by_handle {
|
|||
}
|
||||
|
||||
foreach my $key (sort by_handle keys %queues) {
|
||||
next if $key =~ /sfq/i;
|
||||
$haschild = 0;
|
||||
foreach my $key2 (sort by_handle keys %queues) {
|
||||
if($queues{$key}->{id} eq $queues{$key2}->{parent}) {
|
||||
|
@ -168,4 +171,4 @@ foreach my $key (sort by_handle keys %queues) {
|
|||
print $queues{$key}->{queue},$queues{$key}->{handle}, ".value ",$queues{$key}->{sent}, "\n";
|
||||
}
|
||||
#
|
||||
# vim:syntax=perl
|
||||
# vim:syntax=perl
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
DEVICE=${0##*/tc_}
|
||||
|
||||
mytc() {
|
||||
tc -s class show dev $1 | tr "\n" "|" | sed "s/ \+/ /g" | sed "s/ |/|/g" | sed "s/| /|/g" | sed "s/||/\n/g" | sed "s/|/ /g" | tr ":" "_" | sort -n
|
||||
tc -s class show dev $1 | tr "\n" "|" | sed "s/ \+/ /g" | sed "s/ |/|/g" | sed "s/| /|/g" | sed "s/||/\n/g" | sed "s/|/ /g" | tr ":" "_" | grep -v -i sfq | sort -n
|
||||
}
|
||||
|
||||
case $1 in
|
||||
|
@ -43,14 +43,14 @@ case $1 in
|
|||
;;
|
||||
config)
|
||||
|
||||
echo "graph_order `mytc $DEVICE | awk '{ print $2 "_" $3 }' | sort -n | tr "\n" " "`"
|
||||
echo "graph_order `mytc $DEVICE | awk '{ print $2 "_" $3 }' | tr "\n" " "`"
|
||||
echo "graph_title $DEVICE TC traffic"
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel bits per ${graph_period}'
|
||||
echo 'graph_category network'
|
||||
echo "graph_info This graph shows the TC classes traffic of the $DEVICE network interface. Please note that the traffic is shown in bits per second, not bytes."
|
||||
|
||||
mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 ".label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 ".type COUNTER\n" $2 "_" $3 "_" $4 ".min 0\n" $2 "_" $3 "_" $4 ".cdef " $2 "_" $3 "_" $4 ",8,*" }'
|
||||
mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 ".label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 ".type DERIVE\n" $2 "_" $3 "_" $4 ".min 0\n" $2 "_" $3 "_" $4 ".cdef " $2 "_" $3 "_" $4 ",8,*" }'
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
DEVICE=${0##*/tc_drops_}
|
||||
|
||||
mytc() {
|
||||
tc -s class show dev $1 | tr "\n," "| " | sed "s/ \+/ /g" | sed "s/ |/|/g" | sed "s/| /|/g" | sed "s/||/\n/g" | sed "s/|/ /g" | tr ":" "_" | sort -n
|
||||
tc -s class show dev $1 | tr "\n," "| " | sed "s/ \+/ /g" | sed "s/ |/|/g" | sed "s/| /|/g" | sed "s/||/\n/g" | sed "s/|/ /g" | tr ":" "_" | grep -v -i sfq | sort -n
|
||||
}
|
||||
|
||||
case $1 in
|
||||
|
@ -43,15 +43,15 @@ case $1 in
|
|||
;;
|
||||
config)
|
||||
|
||||
echo "graph_order `mytc $DEVICE | awk '{ print $2 "_" $3 "_drops" }' | sort -n | tr "\n" " "`"
|
||||
echo "graph_order `mytc $DEVICE | awk '{ print $2 "_" $3 "_drops" }' | tr "\n" " "`"
|
||||
echo "graph_title $DEVICE TC traffic drops"
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel bits per ${graph_period}'
|
||||
echo 'graph_vlabel drops per ${graph_period}'
|
||||
echo 'graph_category network'
|
||||
echo "graph_info This graph shows the TC classes traffic drops of the $DEVICE network interface, epxressed in packets."
|
||||
|
||||
# mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 "_drops.label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 "_drops.type COUNTER\n" $2 "_" $3 "_" $4 "_drops.min 0\n" $2 "_" $3 "_" $4 "_drops.cdef " $2 "_" $3 "_" $4 ",8,*" }'
|
||||
mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 "_drops.label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 "_drops.type COUNTER\n" $2 "_" $3 "_" $4 "_drops.min 0" }'
|
||||
mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 "_drops.label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 "_drops.type DERIVE\n" $2 "_" $3 "_" $4 "_drops.min 0" }'
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
DEVICE=${0##*/tc_packets_}
|
||||
|
||||
mytc() {
|
||||
tc -s class show dev $1 | tr "\n," "| " | sed "s/ \+/ /g" | sed "s/ |/|/g" | sed "s/| /|/g" | sed "s/||/\n/g" | sed "s/|/ /g" | tr ":" "_" | sort -n
|
||||
tc -s class show dev $1 | tr "\n," "| " | sed "s/ \+/ /g" | sed "s/ |/|/g" | sed "s/| /|/g" | sed "s/||/\n/g" | sed "s/|/ /g" | tr ":" "_" | grep -v -i sfq | sort -n
|
||||
}
|
||||
|
||||
case $1 in
|
||||
|
@ -43,15 +43,15 @@ case $1 in
|
|||
;;
|
||||
config)
|
||||
|
||||
echo "graph_order `mytc $DEVICE | awk '{ print $2 "_" $3 "_packets" }' | sort -n | tr "\n" " "`"
|
||||
echo "graph_order `mytc $DEVICE | awk '{ print $2 "_" $3 "_packets" }' | tr "\n" " "`"
|
||||
echo "graph_title $DEVICE TC traffic packets"
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel bits per ${graph_period}'
|
||||
echo 'graph_vlabel packets per ${graph_period}'
|
||||
echo 'graph_category network'
|
||||
echo "graph_info This graph shows the TC classes traffic packets of the $DEVICE network interface."
|
||||
|
||||
# mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 "_packets.label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 "_packets.type COUNTER\n" $2 "_" $3 "_" $4 "_packets.min 0\n" $2 "_" $3 "_" $4 "_packets.cdef " $2 "_" $3 "_" $4 ",8,*" }'
|
||||
mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 "_packets.label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 "_packets.type COUNTER\n" $2 "_" $3 "_" $4 "_packets.min 0" }'
|
||||
mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 "_packets.label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 "_packets.type DERIVE\n" $2 "_" $3 "_" $4 "_packets.min 0" }'
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue