Skip to content

Commit

Permalink
Fix timeout bug, thx to Florian Knorn for reporting this
Browse files Browse the repository at this point in the history
  • Loading branch information
dpiquet committed Dec 10, 2014
1 parent 3a42c89 commit b548ea6
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions pve-monitor.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b548ea6

Please sign in to comment.