Может кто-то подскажет, почему timeout (один из параметров при создании snmp сессии) делает задержку ровно в 2 раза больше, чем нужно?
Код: Выделить всё
#!/usr/bin/perl
use Net::SNMP;
my $cpu = '1.3.6.1.2.1.25.2.3.1.3';
my $host = '10.199.11.11';
my $community = 'public';
my $timeout = 5;
my ($session, $error) = Net::SNMP->session (
-hostname => $host ,
-community => $community,
-timeout => $timeout,
);
$result = $session->get_table(-baseoid => $cpu);
my %bla = %{$result};
print "\n",%bla;
my $key;
foreach $key (keys %bla){ print ($key," : ",$bla{$key},"\n");
}
Я делаю запрос на какой-то несуществующий хост. В этом случае timeout должен быть вызван через 5 секунд, но в моем случае мне приходится ждать 10 секунд (задаешь 4, получаешь 8 и т.д.).
Код: Выделить всё
> time ./test.pl
real 0m10.219s
user 0m0.080s
sys 0m0.009s
Код: Выделить всё
> perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
Copyright 1987-2009, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Благодарю за ответы.