Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Reading IP from a file and SNMP

by Anonymous Monk
on Jan 07, 2005 at 14:59 UTC ( #420275=note: print w/replies, xml ) Need Help??


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 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.
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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://420275]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2022-05-18 20:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?