[AGENT++] Send trap on v1/v2c/v3

Dario maljur dmaljur at elma.hr
Tue Sep 12 15:00:01 CEST 2006


Most likely there is no context named "context" in manager that would
receive inform. I'm not quite sure.
Or maybe you didn't initiate v3MP class.


You could consider using Snmp::inform(pdu,target)
Or Snmp::Trap(pdu, target) to send v1/v2/v3 traps.

You can find examples in examples\ directory od snmp_pp in names
snmpInform.cpp and snmpTraps.cpp and receive_trap.cpp

The basic Idea is this:
For v3 traps (or get/set...) u use UTarget and for v1/v2 use CTarget so:
SnmpTarget *ptarget;
UTarget utarget;
CTarget ctarget;
#ifdef _SNMPv3
	utarget( address);
      utarget.set_version( version3);          
     utarget.set_retry( 1);            
     utarget.set_timeout( 100);
utarget.set_security_model(securityModel);
     utarget.set_security_name(securityName);
   pdu.set_security_level( securityLevel);
   pdu.set_context_name (contextName);
   pdu.set_context_engine_id(contextEngineID);
   ptarget = utarget;
#else
 	ctarget.set_version(version1);      //or version2        
     ctarget.set_readcommunity( "someComName"); 
     ptarget = ctarget;
#endif

Snmp *pSnmp = GetSnmp();
pSnmp->trap(somePdu,*ptarget);


This is the way I use it, and it works fine. 

or something like that.
-----Original Message-----
From: agentpp-bounces at agentpp.org [mailto:agentpp-bounces at agentpp.org] On
Behalf Of Jinnee
Sent: Tuesday, September 12, 2006 11:45 AM
To: agentpp
Subject: [AGENT++] Send trap on v1/v2c/v3

HI !

please help me. See demo code on sending trap v1.
////////////////////////////////////////////////////////////
	Vbx* vbs = 0;
	coldStartOid coldOid;
	NotificationOriginator no;
	UdpAddress dest("192.168.1.10/162");
	no.add_v1_trap_destination(dest);
	mib->notify("", coldOid, vbs, 0); // (1)
//////////////////////////////////////////////////////////
I changed "mib->notify("context", coldOid, vbs, 0);", and it compiled ok.
But when it running, it occurs error, "Notification not sent (reason) (addr)
(params): (no access), (  C0 A8 02 2F 00 A2           .../..
), (defaultV1Trap)" .
what's the matter? 
-------------------------
btw, I don't know how how to send trap in v2c and v3. who can help me?
thanks ,... I have idea. 



_______________________________________________
AGENTPP mailing list
AGENTPP at agentpp.org
http://lists.agentpp.org/mailman/listinfo/agentpp




More information about the AGENTPP mailing list