mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
make timeouts customizable
This commit is contained in:
parent
4a7a0de134
commit
2ae2cd6924
@ -56,6 +56,9 @@ if (! eval "require LWP::UserAgent;")
|
||||
|
||||
my %URLS;
|
||||
|
||||
# timeout in seconds for requests
|
||||
my $timeout = $ENV{'timeout'} || 15;
|
||||
|
||||
for (my $i = 1; $ENV{"url$i"}; $i++)
|
||||
{
|
||||
my $url = $ENV{"url$i"};
|
||||
@ -79,7 +82,7 @@ if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => 30);
|
||||
my $ua = LWP::UserAgent->new(timeout => $timeout);
|
||||
|
||||
foreach my $url (keys %URLS) {
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$url));
|
||||
@ -132,7 +135,7 @@ if ( defined $ARGV[0] and $ARGV[0] eq "config" )
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => 15);
|
||||
my $ua = LWP::UserAgent->new(timeout => $timeout);
|
||||
foreach my $name (keys %URLS) {
|
||||
my $url = $URLS{$name};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user