[AGENT++] trap is sent with success but manager does't receive it?
Dario maljur
dmaljur at elma.hr
Wed Oct 4 12:54:58 CEST 2006
Hello.
I'm using AdRem as my manager.
I tried to receive it with example of trap receive in
snmp++/examples/receive_trap.cpp and it works OK.
The port and address are all set good. This is code that sends a trap.
The CSnmpLeaf class is inherited from MibLeaf.
int CSnmpLeaf::SendTrap(I_cAgentEngine *pengine, string address, unsigned
short port)
{
UdpAddress addr(address.c_str());
addr.set_port(port);
SnmpTarget *target;
Pdu pdu; // construct a Pdu object
Vb vb = this->GetTargetVB(); //set the value
vb.set_oid(this->get_oid());
UTarget utarget(addr);
pdu += vb; // append the vb to the pdu
pdu.set_notify_id(this->get_oid()); // set the id of the
trap
pdu.set_notify_enterprise(theFirm); // set up the enterprise of the
trap
utarget.set_security_name(pengine->securityName);
utarget.set_version(version3); // set the SNMP version SNMPV1
or V2 or V3
utarget.set_retry(1); // set the number of auto retries
utarget.set_timeout(100); // set timeout
utarget.set_security_model(pengine->securityModel);
pdu.set_security_level(pengine->securityLevel);
pdu.set_context_name (pengine->contextName);
pdu.set_context_engine_id(pengine->contextEngineID);
target = &utarget;
int iErr = 0;
iErr = pengine->GetSnmp()->trap( pdu,*target);
agent_log->AppendLog("CSnmpLeaf::SendTrap: iErr on SendTrap =
%s",pengine->GetSnmp()->error_msg(iErr));
return iErr;
}
And when I try to use inform instead of trap(.) I get v3MP: EngineIDTable,
don't know engine id for host, port.
I tried changing the version to 1,2, and 3 but now success.
More information about the AGENTPP
mailing list