From b548ea623affd74f035f164b625cde2d73881a37 Mon Sep 17 00:00:00 2001 From: PIQUET Damien Date: Wed, 10 Dec 2014 19:08:13 +0100 Subject: [PATCH] Fix timeout bug, thx to Florian Knorn for reporting this --- pve-monitor.pl | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/pve-monitor.pl b/pve-monitor.pl index eecbd4a..6d4738b 100755 --- a/pve-monitor.pl +++ b/pve-monitor.pl @@ -105,21 +105,13 @@ sub is_number { "conf=s" => \$arguments{conf}, 'version|V' => \$arguments{show_version}, 'help|h' => \$arguments{show_help}, - 'timeout|t=s' => \$arguments{timeout}, + 'timeout|t=s' => \$arguments{timeout}, 'debug' => \$arguments{debug}, ); print "Setting timeout to $arguments{timeout}\n" if $arguments{debug}; -# set the alarm to timeout plugin -# before reading configuration file -local $SIG{ALRM} = sub { - print "Plugin timed out !\n"; - exit $status{UNKNOWN}; -}; -alarm $arguments{timeout}; - if (defined $arguments{show_version}) { print "$0 version $pluginVersion\n"; exit $status{UNKNOWN}; @@ -723,9 +715,6 @@ sub is_number { exit $status{UNKNOWN}; } -# Reset alarm to give a value relative to the number of nodes -alarm ($arguments{timeout} * scalar(@monitoredNodes) + $arguments{timeout}); - for($a = 0; $a < scalar(@monitoredNodes); $a++) { my $host = $monitoredNodes[$a]->{address} or next; my $port = $monitoredNodes[$a]->{port} or next;