-
Notifications
You must be signed in to change notification settings - Fork 72
Description
Hello,
I'm looking at check_snmp_storage.pl but this most likely applies to most if not all the plugins.
From the code, I see that the script is forced to end after the timeout (given in arguments, default 5):
if (defined($o_timeout)) {
verb("Alarm in $o_timeout seconds");
alarm($o_timeout);
}
$SIG{'ALRM'} = sub {
print "No answer from host $o_host:$o_port\n";
exit $ERRORS{"UNKNOWN"};
};
The snmp session has the same timeout value and a retries value of 10:
($session, $error) = Net::SNMP->session(
-hostname => $o_host,
-version => 2,
-community => $o_community,
-port => $o_port,
-retries => 10,
-timeout => $o_timeout,
-domain => $o_domain
);
From my understanding the retries can not be respected as the script will be forced to end after the first snmp attempt (same timeout for the script and the snmp)
Am I right ?
Expected Behavior
Script doesn't end before snmp retries are executed
Current Behavior
No snmp retries executed as the script will end after the snmp timeout of the first attempt
Possible Solution
One solution would be to calculate a global timeout as $o_timeout*10
if (defined($o_timeout)) {
my $global_timeout = $o_timeout * 10;
verb("Alarm in $global_timeout seconds");
alarm($global_timeout);
}
$SIG{'ALRM'} = sub {
print "No answer from host $o_host:$o_port\n";
exit $ERRORS{"UNKNOWN"};
};
Context
On one monitored Linux host we are getting "No answer from host ip:161" from time to time.