I am using AGENT+±4.3.1/SNMP+±3.4.2 and build examples. I tried “atm_mib” and “multi_agent” examples, but don’t see the coldStart being send from either. I made sure the IP address of the trap destination is correct. Also, I have enabled log/debug with max value and don’t see any log about sending the trap. I monitored network with wireshark and also packet monitor in mib-explorer, but did not see any.
The walk and get from mib-explorer works fine. No issue here.
Please, help if I did miss something in the configuration or what it is that I missing to got traps/notification works?
I did not change the code at all, but IP address Here it is:
Vbx* vbs = 0;
coldStartOid coldOid;
NotificationOriginator no;
// add an example destination
UdpAddress dest("10.5.5.29/162");
no.add_v1_trap_destination(dest, "defaultV1Trap", "v1trap", "public");
// send the notification
mib->notify("", coldOid, vbs, 0);
I used both visual studio project and linux target. I did some debugging and see that during process of add_v1_trap destination “targetParmasEntry” and “targetAddrEntry” are still NULL.
Due to this there is no entry in the targetAddress table and notify will not send it.
Maybe you created somehow a persistent configuration file were the necessary configuration rows are missing. Then you should delete reset that configuration.
Another problem could be that due to some autoconf setting, necessary implementation modules (SNMPv3 MIBs) are not available and therefore the configuration fails. But that should be noted with WARN or ERROR log entries in the log.
What I did I used the next line:
no.add_v2_trap_destination(…) and I got the trap now. Why v1 doesn’t work?
Also I need help how to use the notify function for NOTIFICATION-TYPE. I see that for each NOTIFICATION-TYPE object in my MIB the agenpro generate a class that have only “notify” function declared and implemented. When this function will be called?
How I can call this function somewhere from code where I monitor for changes in leafs?
Also, what is recommended practice to scan if a leaf change value and generate a trap/info?
@jkatz, just informed me that there is a bug in the v1 trap destination sample code. But because this is sample code anyway, it does not affect your own trap destination configuration implementation. The sample codes were never meant for production because you will need to handle more details than available by those interfaces.
Nevertheless, I will fix (rework) the sample code to work even for v1.
I understand the this is the sample code. But issue is that this is the only stuff to figure out how the AGENT++ works. There is no guide how to implement traps/notification/inform. Like you have the document for older version of AGNET++ that shows how and when get_request is used. This document should be updated and give examples how to used notify and traps etc.
As I mention in previous post I have no clue when the function “notify” and under what condition will be called, if called at all. Should be a custom scanning thread introduced or not?
This details are very important to use the library in the full capacity. Now everything is base on samples and digging throughout the code to figure out how do achieve something.
At least I found this being issues for me.
I would really appreciate if you would help about the notification/traps.
That is easily answered: the AGENT++ framework will never call notify for custom NOTIFICATION-TYPEs.
Your instrumentation code is responsible to call notify in order to send a notification to the configured targets.
Where I can find the fix for the v1 trap in the sample code?
I also noticed that if want to send v3 trip the application simple exit as soon as it make the call
to “add_v3_trap_destination”. I am sure I provided the right parameters to “add_v3_trap_destination”. Can you please, check this one too?
This far I see only trap v2 works without any issues.
you can just download the latest AGENT++ 4.5.0 and either use the new version with the fix or patch your version with the changed NotificationOriginator::add_v1_trap_destination() function.
I wanted from the same device to send to different Trap receivers different trap versions, but it doesn’t work. All the depends on the first call if it is add_v1_trap first then, even if for the some other receiver the call is: add_v2_trap, but it still sends v1 trap and even use the same IP address???
Is this not allowed in SNMP or I am doing something wrong?
As often written here and elsewhere in the past years:
The add_vX_trap... methods are oversimplified examples only. Never try to use this for something in production!
Saying that, of course you can send different traps to different targets! You “simply” need to configure it right. You will need different target parameter sets and target definitions and use different notification tags.
I am sure that my configuration is correct, I can attach a LOG if needed.
I have three use cases:
In use case 1 configuring the same IP, but trying to send two different trap versions (v1 and v2).
In use case 2 configuring two different IP addresses, and the same trap version (v1 and v1 or v2 and v2).
In use case 2 configuring two different IP addresses, and different trap versions (v1 and v2)
LOG shows correct configuration, but on the wire (with wireshark) I see always the same package send twice while the second never show up.