no cold start up traps

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?

Regards,
Safet

Hi Safet,

When I am starting the unmodified atm_mib sample agent, I see the following log line:

20201218.03:45:32: 4585348608: (1)EVENT  : NotificationGenerator: sent v1 trap (id)(tdomain)(addr)(vbs)(community): (1.3.6.1.6.3.1.1.5.1), (1), (127.0.0.1/162), (0), (public)

Maybe you changed something to break it?

Best regards,
Frank

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.

Regards,
Safet

Hi Safet,

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.

Best regards,
Frank

Hello Frank,

I did not modify the code at all.

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?

Regards,
Safet

@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.

Hello Frank,

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.

Regards,
Safet

Hello Frank,

Can I get any help in regards when the notify will be called from AGENT++/SNMP++ frame work for a NOTIFICATION-TYPE object?

Regards,
Safet

Hello Safet,

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.

Best regards,
Frank

Hello Frank,

Thank you. I was hopping that there is some built-in scanning procedure to check if any NOTIFICATION-TYPE change to generate traps.

Regards,
Safet

Hello Frank,

What would be the fastest way to traverse the whole list of MibLeaf added to Mib from agent code (agent.cpp) where I have only pointer to Mib?

Regards,
Safet

  1. Get the context first with mib->get_context(const NS_SNMP OctetStr&);

  2. Then iterate through the objects:

     MibContext* context = mib->get_default_context();
     context->start_synch();
     OidListCursor<MibEntry> c(context->get_content());
     for (; c.get(); c.next()) {
     	if (c.get()->type() == AGENTPP_LEAF) {
     		// synchronized
     		((MibLeaf*)c.get())->do_something();
     	}
     }
     context->end_synch();

Thank you. Very helpful.