2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Replace digit regex.

Sometimes a digit column is blank and thus fails to be grabbed by the
old regex. Just grab all of them and index as such.
This commit is contained in:
Samuel Smith 2016-08-08 21:56:15 -05:00
parent 56aa139205
commit 0602fba8ac

View File

@ -28,24 +28,24 @@ 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,
};
@ -161,8 +161,9 @@ lof_up.min 0
my $url = $ENV{url} || "http://192.168.1.254/cgi-bin/dslstatistics.ha";
my $html = HTTP::Tiny->new(timeout => 1 )->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]