[AGENT++] newbie: How to send trap via agent++?

John Mudd johnbmudd at gmail.com
Mon Feb 26 15:09:43 CET 2007


I just want to send a trap.



I found the following in the FAQ.
        Vbx* vbs = 0;
	coldStartOid coldOid;
	Mib::notify(vbs, 0, coldOid, "", "");

I tried this but get the following error.
agent.cpp:432: error: no matching function for call to
`Agentpp::Mib::notify(Agentpp::Vbx*&, int, coldStartOid&, const
char[1], const char[1])'
../../../include/agent_pp/mib.h:2418: note: candidates are: virtual
int Agentpp::Mib::notify(const OctetStr&, const Agentpp::Oidx&,
Agentpp::Vbx*, int, unsigned int)




I saw the following example in the mailing list archives:
mib->notify("", coldOid, vbs, 0);

And In the examples/static_table/src/agent.cpp file I found the following:
no.generate(vbs, 0, coldOid, "", "");

Both execute and I get the same output from the receiving agent.

localhost [127.0.0.1]: Trap DISMAN-EVENT-MIB::sysUpTimeInstance =
Timeticks: (230) 0:00:02.30, SNMPv2-MIB::snmpTrapOID.0 = OID:
SNMPv2-MIB::coldStart




But I still haven't sent a trap, right?  I used the
consoleExamples/snmpTraps.cpp (from snmp++ package)  to send a v2
trap.  When I run it I get the following output from the agent.

localhost [127.0.0.1]: Trap DISMAN-EVENT-MIB::sysUpTimeInstance =
Timeticks: (2528952619) 292 days, 16:52:06.19,
SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::coldStart,
SNMPv2-SMI::enterprises.11.2.16.2 = STRING: "SNMP++ Trap Send Test"

This is what I want!  What do I need to change/add to the above
agent++ code so that I can send a trap as in the snmp++ sample
program?



I'm tempted to just use the snmp++ sample code but I have been
*advised* that the agent++ package will provide me with advantages
over the snmp++ code.  Are there advantages?


John



More information about the AGENTPP mailing list