1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-24 09:57:09 +00:00

now works on url's with any non alpha-numeric character

This commit is contained in:
steelblade 2010-11-17 19:36:35 +01:00 committed by Steve Schnepp
parent a7be1b2079
commit 19f744baed

View file

@ -60,7 +60,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "config") {
foreach my $url (@urls) {
my $label = $url;
#fix up our label name to be a valid variable name
$label =~ s@[\/-]@_@g;
$label =~ s@[^A-Za-z0-9_]@_@g;
print "$label.label $url\n";
print "$label.type GAUGE\n";
}
@ -78,9 +78,9 @@ sub req_time {
my $outdir = '/tmp/munin/' . int(rand(32000));
system("mkdir -p $outdir");
if ($ENV{'action'} eq "full") {
$time = `/usr/bin/time -f "%e" wget -pq -P $outdir --header "Accept-Encoding: gzip,deflate" $url 2>&1`;
$time = `/usr/bin/time -f "%e" wget -pq -P $outdir --header "Accept-Encoding: gzip,deflate" "$url" 2>&1`;
} elsif ($ENV{'action'} eq "index") {
$time = `/usr/bin/time -f "%e" wget -q -P $outdir --header "Accept-Encoding: gzip,deflate" $url 2>&1`;
$time = `/usr/bin/time -f "%e" wget -q -P $outdir --header "Accept-Encoding: gzip,deflate" "$url" 2>&1`;
}
system("rm -rf $outdir");
return $time;
@ -90,7 +90,7 @@ sub req_time {
foreach my $url (@urls) {
my $label = $url;
#fix up our label name to be a valid name
$label =~ s@[\/-]@_@g;
$label =~ s@[^A-Za-z0-9_]@_@g;
print "$label.value " . req_time($domain.$url);
}