Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Making a scalable Net::SNMP script?

by dingus (Friar)
on Nov 21, 2002 at 18:44 UTC ( [id://214862]=note: print w/replies, xml ) Need Help??


in reply to Making a scalable Net::SNMP script?

You could use either an array or (probably better) a hash something like this:
my %cmdtable=( ### general OID for system up time sysUpTime => '1.3.6.1.2.1.1.3.0', ### These are Cisco OID's which i use for the AS5400 bank ModemsAvailable = '1.3.6.1.4.1.9.9.47.1.1.7.0', ModemsUnavailable = 1.3.6.1.4.1.9.9.47.1.1.8.0')
and then indeed you can do a
my @results; for (keys %cmdtable) { ...
If you need them ordered you can EITHER have the order in a separate array or have 2 arrays one for command and one for the OID.

Assuming you need to do this sort of thing for many devices and you wish to do it in a reasonable timeframe you may want to look at POE as that should nicely cope with multiple parallel SNMP requests an responses. I seem to recall from days querying SNMP devices that responses are often in the seconds (or worse if you have to retry), which means that if you need to do 100 queries on 100 differnt devices in a strict sequence you get a script that runs for 3 hours instead of under two minutes! POE should let you parallelise nicely - indeed the POE cookbook may actually have sample code for this thing.

Dingus


Enter any 47-digit prime number to continue.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-25 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found