File: async1.pl

package info (click to toggle)
net-snmp 5.9.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 37,540 kB
  • sloc: ansic: 282,201; perl: 17,710; sh: 12,006; makefile: 2,712; python: 735; xml: 663; pascal: 62; sql: 47
file content (17 lines) | stat: -rw-r--r-- 432 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use SNMP;

$SNMP::auto_init_mib = 0; 

$sess = new SNMP::Session(); 

sub poller {  
   # VarList is undefined if TIMEOUT occured
   if (!defined($_[1])) { die "request timed out[$_[0]->{ErrorStr}]\n"; }
   if ($i++>100000) { die "completed 500 polls\n"; }
   #print $_[1][0]->tag, " = ", $_[1][0]->val, "\n";
   $_[0]->get($_[1], [\&poller, $_[0]]);
} 

$sess->get([[".1.3.6.1.2.1.1.3.0"]], [\&poller, $sess]); 

SNMP::MainLoop();