/usr/share/doc/libsnmp-perl/examples/async2.pl is in libsnmp-perl 5.7.3+dfsg-1.8ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | use SNMP;
$SNMP::auto_init_mib = 0;
$sess = new SNMP::Session();
sub poller_handler {
if (++$i>500) { die "completed 500 polls\n"; };
# VarList is undefined if TIMEOUT occured
if (!defined($_[1])) {
warn "request timed out[$_[0]->{ErrorStr}]\n";
return;
}
# print "$i) ",$_[1][0]->tag, " = ", $_[1][0]->val, "\n";
}
# $sess->get([[".1.3.6.1.2.1.1.3.0"]], [\&poller_handler, $sess]);
SNMP::MainLoop(.1,sub {for (1..50) {$sess->get([['.1.3.6.1.2.1.1.3.0']], [\&poller_handler, $sess]);} });
|