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:
parent
a7be1b2079
commit
19f744baed
1 changed files with 4 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue