[AGENT++] The trap is received but callback isn't executed?

Jochen Katz katz at agentpp.com
Fri Aug 4 21:32:41 CEST 2006


Hi,

> OK. that had a half/half effect. But more questions had arise. 1.
> What does CNotifyEvent class does. I couldn't find anything on for
> what is for. Documentation doesn't say anything aside from class 
> prototype.

CNotifyEvent is an internal class, I just wantetd to point you to the
function that actually filters the traps.

> By browsing through code, I found that CNotifyEvent::notify_filter
> will filter out if there are errors in collections.

No, not just errors (invalid entries), it checks if the trap matches the
collections: If OidCollection is not empty, the trap id has to match one
entry, otherwise it is ignored.

> But isn't that what Snmp::get_notify_filter() does?

???

> 2. How come that program can initiate callback only when 
> OidCollection is empty. Shouldn't OidCollection be used to filter out
> unwanted traps by setting collection of Oids to listen for?

At least if I change the OidCollection of receive_trap.cpp I can filter
the traps of snmpTraps.cpp, so the OidCollection can be empty (no
filter) or contain Oids (one Oid has to match).

With the lines "right", the callback is called and with these two
"right" lines removed, the trap is filtered.

receive_trap.cpp:

   OidCollection oidc;
   TargetCollection targetc;
   Oid false1("1.3.6.1.6.3.1.1.5.2");
   Oid right("1.3.6.1.6.3.1.1.5.1");
   Oid false2("1.3.6.1.6.3.1.1.5.4");

   oidc += false1;
   oidc += right;
   oidc += false2;

> 3. How do I know witch trap sending mechanism to use? 
> NotificationOriginator::notify(), or 
> NotificationOriginator::generate() or maybe Snmp::trap().

Well: just use the one that suits your needs (There was another mail
recently about this, check the list archive): trap() is easy to call for
simple setups, but requires reimplementing the notification mibs the
NotificationOriginator uses if you have multiple trap receivers.

> 4. There is still one more problem, besides that oid collection in 
> Manager must be empty to init. Callback func. And that is that number
> of vb-s array must be 0 or callback is not initiated.

Which Vb array has to be empty? The one within the trap? snmpTraps and
receive_trap have Vbs within the trap...

Regards,
  Jochen



More information about the AGENTPP mailing list