1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-09-19 00:53:19 +00: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 { use constant {
down_rate => 0, down_rate => 2,
up_rate => 1, up_rate => 3,
sn_down => 14, sn_down => 23,
sn_up => 15, sn_up => 24,
line_attn_down => 16, line_attn_down => 25,
line_attn_up => 17, line_attn_up => 26,
power_down => 18, power_down => 27,
power_up => 19, power_up => 28,
err_sec_down => 20, err_sec_down => 29,
err_sec_up => 21, err_sec_up => 30,
los_down => 22, los_down => 31,
los_up => 23, los_up => 32,
lof_down => 24, lof_down => 33,
lof_up => 25, lof_up => 34,
fec_down => 26, fec_down => 35,
fec_up => 27, fec_up => 36,
crc_down => 28, crc_down => 37,
crc_up => 29, 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 $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 => 1 )->get($url);
die "Couldn't fetch $url" unless $html->{success}; 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 print qq|multigraph nvg510_speed
down_rate.value $stats[down_rate] down_rate.value $stats[down_rate]