Rob Bloodgood wrote:
On Mon, Dec 20, 2004 at 10:50:42AM -0700, Jim wrote:

The main session _starts by creating a PoCo::SNMP instance that grabs a list of VLANs from the switch. For each of those VLANs, there's a session created to grab four other OIDs based via a community-string-indexed request. This all verified to work fine.

I'm getting hung up on knowing when these last four OIDs are done. If I post a "finish" message to the end of the queue and try to process the data in a _stop event, the SNMP session is torn down before all of its data is retrieved. Without a "finish" the SNMP session doesn't die and the session (properly, I think) stays running.

Hi!  I hacked PoCo::SNMP together, but I'm *not* an SNMP expert.

That being said: it sounds like you're issuing 4 different OID requests. It also sounds like you're creating a session per VLAN.

You ONLY create a session per VLAN *if* each VLAN has a different IP address. Otherwise you simply send another request to your main SNMP component instance.

Each vlan has the same IP, but a different community string; is that sufficient for the factory to create a new session?


I know that sounds odd, but to get an OID (e.g .1.3.6.1.2.1.17.4.3.1.2 to get a list of bridge ports) for vlan 321, one uses "[EMAIL PROTECTED]" as the comstring (our comstring isn't "public" but you get the idea).

As far as the OID requests, you should be able to ask for all 4 in one query (unless, of course, they're all on different hosts). If you can't, or you're dealing with async issues, I've solved this type of situation by creating a little object class that has placeholders for each expected response, and an is_done() method that returns true when all placeholders are filled (and be sure to code that an error counts as filling the correct slot for that request's answer).

Once you get your is_done() running true, and you're finished with said host, you can then shut down the component instance for that host if your program isn't a long-running daemon.

An important detail that I left out is that I'm using "walk" to get the entire table. As Net::SNMP::get_table doesn't look for array references as the value of -basoid, I can't get it in one request.


I just switched to getbulk as the related get_bulk_request() seems to support an OID list, but my test switch isn't responding correctly. I'll need to fiddle with that...

Have you released the class that implements is_done()? I don't imagine it's too difficult, but I'm lazy... :-)

J



Reply via email to