etingof / pysnmp

Python SNMP library
http://snmplabs.com/pysnmp/
BSD 2-Clause "Simplified" License
584 stars 201 forks source link

How to find msgGlobalData msgID from snmpV3 inform #394

Open charliebsimms opened 3 years ago

charliebsimms commented 3 years ago

We are using pysnmp to transform snmpV3 informs from devices and are successfully processing the messages. Problem: If alarms do not arrive in the correct order for example linkUp(Clear alarm) then linkDown(Set alarm), since snmpV3 does not support alarm timestamp created by the device we cannot determine the order therefore if the device was showing a fault and then subsequently has been cleared. Scenario: If the device fails to sends the snmpV3 inform linkDown to the snmp-collector because of network issues or it is being restarted, the device will retry in 30 seconds. if the snmp-collector comes back up within the 30 seconds and the device is cleared within this time, the device will send a linkUp to the snmp-collector which it will receive successfully. The device will then send the linkDown to the snmp-collector after the linkUp has been processes. Possible solution: The unique msgGlobalData msgID of the snmpV3 inform remains the same for each repeated attempt of sending the alarm inform and therefore we can use this to order the sequence of when the alarm was created from a device. Question How do we obtain the msgGlobalData msgID from the snmpV3 inform message from a device using pysnmp module or is there another way to correctly order the snmpV3 inform messages?

lextm commented 1 year ago

The statement of "snmpV3 does not support alarm timestamp created by the device" is not true. SNMP INFORM message body does contain the timestamp in PDU.

Thus, in the scenario you described the manager side can tell from that PDU at what time the INFORM message was constructed and decide how to respond in the best way. The solution or follow-up question you posted were not applicable then.