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.