Fix geowebcache-bandwidth

This commit is contained in:
Romain MAZIERE 2020-04-22 18:09:17 +02:00 committed by Lars Kruse
parent 46f383f92c
commit 0cfcf2ccbf
1 changed files with 5 additions and 5 deletions

View File

@ -1,10 +1,10 @@
#!/usr/bin/perl #!/usr/bin/perl
# -*- perl -*- # -*- perl -*-
# Author Rodolphe Quiédeville <rodolphe@quiedeville.org> # Author Rodolphe Quiédeville <rodolphe@quiedeville.org>
# Licence : GPLv2 # Licence : GPLv2
# Code based on tomcat_volume plugin by # Code based on tomcat_volume plugin by
# Rune Nordbøe Skillingstad <runesk@linpro.no> # Rune Nordbøe Skillingstad <runesk@linpro.no>
=head1 NAME =head1 NAME
@ -41,7 +41,7 @@ HTTP port numbers
=head1 AUTHOR =head1 AUTHOR
Rodolphe Quiédeville <rodolphe@quiedeville.org> Rodolphe Quiédeville <rodolphe@quiedeville.org>
=head1 USAGE =head1 USAGE
@ -111,11 +111,11 @@ if(exists $ARGV[0] and $ARGV[0] eq "config") {
my $ua = LWP::UserAgent->new(timeout => $TIMEOUT); my $ua = LWP::UserAgent->new(timeout => $TIMEOUT);
my $response = $ua->request(HTTP::Request->new('GET',$url)); my $response = $ua->request(HTTP::Request->new('GET',$url));
if ($response->content =~ '<tr><td>60 seconds</td><td>\d+</td><td>\d+.\d+ /s</td><td>\d+</td><td>(\d+\.\d+) ([km]?)bps') { if ($response->content =~ '<tr><td>60 seconds</td><td>\d+</td><td>\d+.\d+ /s</td><td>\d+</td><td>(\d+\.\d+)&nbsp;([km]?)bps') {
my $value = $1; my $value = $1;
$value = $value * 1024 if ($2 eq 'k'); $value = $value * 1024 if ($2 eq 'k');
$value = $value * 1024 * 1024 if ($2 eq 'm'); $value = $value * 1024 * 1024 if ($2 eq 'm');
print "bandw.value " . $value; print "bandw.value " . $value . "\n";
} else { } else {
print "bandw.value U\n"; print "bandw.value U\n";
} }