in reply to Re: Reading IP from a file and SNMP
in thread Reading IP from a file and SNMP

yes, but use the SNMP module that comes with net-snmp. you can use the async interface to send out requests to multiple devices without waiting for each one to complete before sending out the next. i can get the sysDescr string from 1072 devices in around 20 seconds or so.

Replies are listed 'Best First'.
Re^3: Reading IP from a file and SNMP
by Anonymous Monk on Jan 08, 2005 at 15:20 UTC
    That's good news! Could you be more specific or just show me some lines of code. I was reading the docs of net-snmp and tehre was only an exapmle of C async poll. Thanks!
      there are a couple examples in the net-snmp/perl/SNMP/examples directory. there's also a bit in the SNMP perldoc. for the most part you just add a callback to the get command (which will get called when the reply comes back) and then call SNMP::MainLoop.
      use SNMP; my $session = SNMP::Session->new( ... ); sub callback { if ( !defined( $_[0] ) { warn "request timed out: $session->{ErrorStr}\n"; } # do something with VarbindList $_[0] } $session->get( [[ $oid ]], \&callback ); SNMP::MainLoop();
      my code is a bit more complex, taking a list of hosts, a number of outstanding reqests and a set of OIDs. it returns all of the info in a hash. i'll see if i can clean it up a bit for posting.