in reply to Net::SNMP get_request() caching results?
Something that has worked quite reliably for me is to destroy and re-create the SNMP object after each error. This is probably not too costly, since creating a UDP socket does not require a connection setup.
The code I use, looks like the following:
Note however that you must ensure that the required parameters to create a new SNMP session are available to my_create_snmp(). This probably includes global variables or constants. I tend to prefer the later.sub my_create_snmp { my $snmp = ... # Place here the code to create your # SNMP handler. return $snmp; } ... $response = $session->get_request($cmd); if (!defined($response)) { ... $session = my_create_snmp(); next; }
Regards.
|
|---|