in reply to Reading IP from a file and SNMP

I have to do almost the same task, polling a single OID from a bunch of devices. I don't use net::snmp, but the snmpget from net-snmp. My problem is, that I have to poll aprox 8000 (8k) devices and each poll is aprox 1 sec => 8000 seconds. Do you think net::snmp module will increase the speed( I doubt). My next take will be forking and multithreading and here I need some help, please. Thanks in advance!

Replies are listed 'Best First'.
Re^2: Reading IP from a file and SNMP
by theroninwins (Friar) on Jan 09, 2005 at 18:10 UTC
    If you still need help I can send you the final prog as I use it
      It will be great ! Thanks! ibatch@gmail.com
Re^2: Reading IP from a file and SNMP
by Anonymous Monk on Jan 08, 2005 at 01:05 UTC
    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.
      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.