Maybe you need to post the debug log here. I do not see a reason why your use cases shouldn’t be possible to be realised if configured correctly.
Hello Frank,
Here is the log for the next use case: two different host IP: H1@10.5.5.28/162 and H2@10.5.5.30/162 and first to receive v1 coldStart and second to receive v2 coldStart.
From the log you can see that there is two message sent to H1.
20210203.18:38:06: 0: (1)INFO : RECEIVERS
20210203.18:38:06: 0: (1)INFO : IPAddress: (ipaddress): (10.5.5.28/0)
20210203.18:38:06: 0: (1)INFO : IPPort: (port): (162)
20210203.18:38:06: 0: (1)INFO : Type: (type): (v1)
20210203.18:38:06: 0: (1)INFO : Community/Security Name: (name): (publicv1)
20210203.18:38:06: 0: (1)INFO : SecurityLevel: (level) (level): (NoAuthNoPriv), (1)
20210203.18:38:06: 0: (1)INFO : main: SNMP ColdStart (IPAddress) (Type) (Name): (10.5.5.28/162), (0), (publicv1)
20210203.18:38:06: 0: (1)EVENT : NotificationGenerator: (address) (name) (tag) (community): (10.5.5.28/162), (defaultV1Info), (v1trap), (publicv1)
20210203.18:38:06: 0: (1)EVENT : snmpTargetParamsEntry: (index) (name) (mpModel) (secModel) (secName) (secLevel): (100.101.102.97.117.108.116.86.49.73.110.102.111), (defaultV1Info), (0), (1), (publicv1), (1)
20210203.18:38:06: 0: (1)EVENT : snmpTargetAddrEntry: (name) (tdomain) (taddres) (taglist) (params): (10.5.5.28/162), (1.3.6.1.6.1.1), ( 0A 05 05 1C 00 A2 …
), (v1trap), (defaultV1Info)
20210203.18:38:06: 0: (7)DEBUG : Vacm: Access requested for: (model) (name) (level) (type) (context) (oid): (1), (publicv1), (1), (3), (), (1.3.6.1.6.3.1.1.5.1)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getGroupName: (model) (name): (1), (publicv1), (1.3.6.1.6.3.16.1.2.1.3.1.8.112.117.98.108.105.99.118.49)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getViewName: (group) (context) (model) (level) (type): (publicv1), (), (1), (1), (3)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getViewName: (matched group): (publicv1)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getViewName: (matched context): ()
20210203.18:38:06: 0: (7)DEBUG : Vacm: isInMibView: (viewName) (subtree): (testView1), (1.3.6.1.6.3.1.1.5.1)
20210203.18:38:06: 0: (1)DEBUG : Initialized request_id to 16724.
20210203.18:38:06: 0: (1)DEBUG : ++ SNMP++, Send a Trap
20210203.18:38:06: 0: (1)DEBUG : trap called with UTarget
20210203.18:38:06: 0: (1)DEBUG : from inet_ntop: fe80::d05a:e9dc:f973:1b34
20210203.18:38:06: 0: (4)DEBUG : SNMPMessage: return value for build message: (0)
20210203.18:38:06: 0: (1)DEBUG : ++ SNMP++: sending to 10.5.5.28/162:
20210203.18:38:06: 0: (3)DEBUG : 30 23 02 01 00 04 08 70 75 62 6C 69 63 76 31 A4
20210203.18:38:06: 0: (3)DEBUG : 14 06 01 00 40 04 FF FF FF FF 02 01 00 02 01 00
20210203.18:38:06: 0: (3)DEBUG : 43 01 11 30 00
20210203.18:38:06: 0: (1)EVENT : NotificationGenerator: sent v1 trap (id)(tdomain)(addr)(vbs)(community): (1.3.6.1.6.3.1.1.5.1), (1), (10.5.5.28/162), (0), (publicv1)
20210203.18:38:06: 0: (1)INFO : ===================================
20210203.18:38:06: 0: (1)INFO : IPAddress: (ipaddress): (10.5.5.30/0)
20210203.18:38:06: 0: (1)INFO : IPPort: (port): (162)
20210203.18:38:06: 0: (1)INFO : Type: (type): (v2c)
20210203.18:38:06: 0: (1)INFO : Community/Security Name: (name): (publicv2)
20210203.18:38:06: 0: (1)INFO : SecurityLevel: (level) (level): (NoAuthNoPriv), (1)
20210203.18:38:06: 0: (1)INFO : main: SNMP ColdStart (IPAddress) (Type) (Name): (10.5.5.30/162), (1), (publicv2)
20210203.18:38:06: 0: (1)EVENT : snmpTargetParamsEntry: (index) (name) (mpModel) (secModel) (secName) (secLevel): (100.101.102.97.117.108.116.86.50.73.110.102.111), (defaultV2Info), (1), (2), (publicv2), (1)
20210203.18:38:06: 0: (1)EVENT : snmpTargetAddrEntry: (name) (tdomain) (taddres) (taglist) (params): (10.5.5.30/162), (1.3.6.1.6.1.1), ( 0A 05 05 1E 00 A2 …
), (v2trap), (defaultV2Info)
20210203.18:38:06: 0: (7)DEBUG : Vacm: Access requested for: (model) (name) (level) (type) (context) (oid): (1), (publicv1), (1), (3), (), (1.3.6.1.6.3.1.1.5.1)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getGroupName: (model) (name): (1), (publicv1), (1.3.6.1.6.3.16.1.2.1.3.1.8.112.117.98.108.105.99.118.49)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getViewName: (group) (context) (model) (level) (type): (publicv1), (), (1), (1), (3)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getViewName: (matched group): (publicv1)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getViewName: (matched context): ()
20210203.18:38:06: 0: (7)DEBUG : Vacm: isInMibView: (viewName) (subtree): (testView1), (1.3.6.1.6.3.1.1.5.1)
20210203.18:38:06: 0: (1)DEBUG : Initialized request_id to 12478.
20210203.18:38:06: 0: (1)DEBUG : ++ SNMP++, Send a Trap
20210203.18:38:06: 0: (1)DEBUG : trap called with UTarget
20210203.18:38:06: 0: (1)DEBUG : from inet_ntop: fe80::d05a:e9dc:f973:1b34
20210203.18:38:06: 0: (4)DEBUG : SNMPMessage: return value for build message: (0)
20210203.18:38:06: 0: (1)DEBUG : ++ SNMP++: sending to 10.5.5.28/162:
20210203.18:38:06: 0: (3)DEBUG : 30 23 02 01 00 04 08 70 75 62 6C 69 63 76 31 A4
20210203.18:38:06: 0: (3)DEBUG : 14 06 01 00 40 04 FF FF FF FF 02 01 00 02 01 00
20210203.18:38:06: 0: (3)DEBUG : 43 01 13 30 00
20210203.18:38:06: 0: (1)EVENT : NotificationGenerator: sent v1 trap (id)(tdomain)(addr)(vbs)(community): (1.3.6.1.6.3.1.1.5.1), (1), (10.5.5.28/162), (0), (publicv1)
20210203.18:38:06: 0: (7)DEBUG : Vacm: Access requested for: (model) (name) (level) (type) (context) (oid): (2), (publicv2), (1), (3), (), (1.3.6.1.6.3.1.1.5.1)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getGroupName: (model) (name): (2), (publicv2), (1.3.6.1.6.3.16.1.2.1.3.2.8.112.117.98.108.105.99.118.50)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getViewName: (group) (context) (model) (level) (type): (publicv2), (), (2), (1), (3)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getViewName: (matched group): (publicv2)
20210203.18:38:06: 0: (7)DEBUG : Vacm: getViewName: (matched context): ()
20210203.18:38:06: 0: (7)DEBUG : Vacm: isInMibView: (viewName) (subtree): (testView1), (1.3.6.1.6.3.1.1.5.1)
20210203.18:38:06: 0: (1)DEBUG : Initialized request_id to 30358.
20210203.18:38:06: 0: (1)DEBUG : ++ SNMP++, Send a Trap
20210203.18:38:06: 0: (1)DEBUG : trap called with UTarget
20210203.18:38:06: 0: (4)DEBUG : SNMPMessage: return value for build message: (0)
20210203.18:38:06: 0: (1)DEBUG : ++ SNMP++: sending to 10.5.5.30/162:
20210203.18:38:06: 0: (3)DEBUG : 30 43 02 01 01 04 08 70 75 62 6C 69 63 76 32 A7
20210203.18:38:06: 0: (3)DEBUG : 34 02 02 76 97 02 01 00 02 01 00 30 28 30 0D 06
20210203.18:38:06: 0: (3)DEBUG : 08 2B 06 01 02 01 01 03 00 43 01 13 30 17 06 0A
20210203.18:38:06: 0: (3)DEBUG : 2B 06 01 06 03 01 01 04 01 00 06 09 2B 06 01 06
20210203.18:38:06: 0: (3)DEBUG : 03 01 01 05 01
20210203.18:38:06: 0: (1)EVENT : NotificationGenerator: sent trap (vers)(id)(tdomain)(addr)(vbs)(community/secName)(status): (1), (1.3.6.1.6.3.1.1.5.1), (1), (10.5.5.30/162), (0), (publicv2), (0)
20210203.18:38:06: 0: (1)INFO : ===================================
20210203.18:38:06: 0: (1)DEBUG : TaskManager: thread started
20210203.18:38:06: 0: (1)DEBUG : Thread: started (tid): (25800)
20210203.18:38:06: 0: (1)DEBUG : TaskManager: thread started
20210203.18:38:06: 0: (1)DEBUG : Thread: started (tid): (11288)
20210203.18:38:06: 0: (1)DEBUG : TaskManager: thread started
20210203.18:38:06: 0: (1)DEBUG : Thread: started (tid): (29212)
20210203.18:38:06: 0: (1)DEBUG : TaskManager: thread started
20210203.18:38:06: 0: (1)DEBUG : Thread: started (tid): (31188)
20210203.18:38:06: 0: (1)DEBUG : TaskManager: task manager found
20210203.18:38:06: 0: (2)DEBUG : TaskManager: after notify
From the above log snippets, both traps are sent as it supposed to be according to your use case description, or am I missing something?
What you can see when it is time to send message to H2@10.5.5.30, first the one actually sent is for the H1@10.5.5.28 and then the one for H2. I expect here to see only the one for the host H2. Is it right?
If you look at the code snippets you took you can see the target address is set to 10.5.5.30/162
but inside of the SNMP pdu you can see address is 10.5.5.28/162.
Then in the next SNMP pdu has the correct IP 10.5.5.30/162.
Looks like the SNMP pdu (socket) when created for the current message steel have in the buffer the previous contest.
Regards,
Safet
Within a SNMP PDU there is no target address. Please also explain what you understand by „when it is time to send“?
When you have setup the target configuration a notification triggered using the NotificationOriginator class will be send to all configured targets at once.
Hello Frank,
Here is the key “notification originator class will send all targets at once”.
I have a class that encapsulate configuration and sending of traps. For each receiver there would be on object of that class instantiated and that caused that I see multiple traps for the same target. I will change the code to make a call to send traps after all receiver are added to the list.
Thank you for your support and time. I appreciate it very much.
Regards,
Safet