[AGENT++] Different Ways to Send Traps (Notifications)

Jochen Katz katz at agentpp.com
Wed Jul 19 20:01:41 CEST 2006


Hi,

> Method 1 : Snmp::trap()
> -----------------------
> 
> This appears in the snmp++/consoleExamples/snmpTraps.cpp and uses the
> method ...
> 
> Snmp::trap( Pdu& pdu, const SnmpTarget& target );
> 
> 1.1 I assume this method is less flexible and now obsolete ?

no, it's not obsolete. You can/have to use it, if you don't use agent++.
And if you don't want to use the complete (more flexible but more
complex) NotificationOriginator framework, you can even use it from an
agent++ agent.

> 2.1. However, the other trap mechanism use agentppNotifyTestAllTypes
> which is a specialisation of NotificationOriginator (see code extract
> below). Why ? It is it purely for the error checking and logging ?

It looks like that, but one line is wrong:
Mib::instance->
notify(context, oidAgentppNotifyTestAllTypes, vbs, >>>9<<<);

> Method 3 : NotificationType
> ---------------------------
> 
> Using the AgenPro2 code generator, I get NotificationType classes such
> as below :
> 
> // MyMibElemAlert inherits from NotificationType
> int MyMibElemAlert::notify( const NS_SNMP OctetStr& context, Vbx* vbs,
> int sz )
> {
>     //--AgentGen BEGIN=elemAlert::notify
>     //--AgentGen END
>     return Mib::instance->notify( context, oidElemAlert, vbs, sz );
> }
> 
> 3.1. How or where is this method NotificationType::notify() called ? Or
> how does this fit into the trap mechanism ?

You have to call it yourself.



More information about the AGENTPP mailing list