On Mon, Dec 20, 2004 at 10:50:42AM -0700, Jim wrote: > I'm new to POE, so this could be relatively simple. My apologies if it > is, my search efforts turned up empty as I'm not sure what question to ask.
Welcome! > Largely to learn POE, I'm doing a proof-of-concept with POE and > PoCo::SNMP to gather SNMP data from a couple thousand switches and store > it to a SQL database. > > The short story of the flow (this example will be for just one switch): > > 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. 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. HTH! L8r, Rob