[AGENT++] Please clarify NotificationOriginator usage

Frank Fock fock at agentpp.com
Tue Apr 20 23:01:15 CEST 2010


Hi Yasemin,

NotificationOriginator::generate should not be used
directly (and it will not work in most cases, because
of missing MIB instance references).

Please use always Mib::instance->notify instead.
This method will also work in an AgentX subagent.

See more details inline below:

On 20.04.2010 15:34, Yasemin YILMAZ wrote:
> Hi all,
>
> I'm in confusion for which NotificationOriginator usage mechanism sould be
> processed. I have eight NOTIFICATION-TYPE traps that does not contain any
> objects (OBJECTS declaration), in order to only send trap such as coldStart
> trap. For example;
>
> myCpuUsageExceededTrap NOTIFICATION-TYPE
>      STATUS current
>      DESCRIPTION ""
>      ::= { myTraps 6 }
>
>
> I've read agentpp list's subjects related to NotificationOriginator but I
> can not understand completely when NotificationOriginator::generate or
> Mib::instance->notify should be prefer to call? Or we can say there is no
> differences between them?
>
> If I use NotificationOriginator as following is it a fault, isn't it?

Yes. See blow..

> Because Mib constructor sets it's notificationSender to 0 and if we don't
> call set_notification_sender to set myNO and Mib's notify function creates
> newly NotificationOriginator instance and sets to local member
> notificationSender. In that case, how can Mib instance know trap destination
> (myDest("127.0.0.1/162") )? (if Mib doesn not use myNO).

You should use the following code instead:
Vbx* vbs = 0;
NotificationOriginator* myNO = new NotificationOriginator();
mib->set_notification_sender(myNO);
UdpAddress myDest("127.0.0.1/162");
myNO->add_v1_trap_destination(myDest);
mib->notify("", cpuTrapOid, vbs, 0);

>
>      Vbx* vbs = 0;
>      NotificationOriginator myNO;
>      UdpAddress myDest("127.0.0.1/162");
>      myNO.add_v1_trap_destination(myDest);
>      mib->notify("", cpuTrapOid, vbs, 0);
>
>
> Sould we prefer to call myNO.generate instead of mib->notify if we
> decide not to use Mib instance's notificationSender? If we do such,
> are any properties usage disabled?
No.
>
> One more a question. We see that agentpp_notifytest_mib.h created a
> agentppNotifyTestAllTypes class derived NotificationOriginator. Is
> that a mandotory?

No, this is a special usage.

> Must we create a class derived NotificationOriginator equaled to
> NOTIFICATION-TYPE in MIB module file written according to SMIv2
> standart?
>
No, of course not.

> Can we say such thing: we write only #define for trap oid and we use
> as following:
>
>      #define cpuTrapOid     "1.3.6.1.4.1.53600.6.2.0.1"
>          ....
>
>      Vbx* vbs = 0;
>      NotificationOriginator myNO;
>      UdpAddress myDest("127.0.0.1/162");
>      myNO.add_v1_trap_destination(myDest);
>      myNO.generate(vbs, 0, cpuTrapOid, "", "");
>
> Please clarify these topics.

This will not work, because the snmp_target_mib and
snmp_notification_mib instances are instantiated.

Best regards,
Frank

>
> Thanks in advance for your explanations and helps,
>
>
> Best regards,
> Yasemin
>
>
>
>
>   equaled to<http://www.tureng.com/search/equaled+to>
>   f
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/agentpp

-- 
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the AGENTPP mailing list