How do I add a second trap recipient?
Frank Fock
Frank.Fock____t-online.de
Wed Dec 6 22:27:13 CET 2000
Hi Al,
It's a bug in the add_v1_trap method of NotificationOriginator.
Change it as follows and it will work (this fix will be part of the
next update of AGENT++):
boolean NotificationOriginator::add_v1_trap_destination(const UdpAddress& addr)
{
OctetStr name("defaultV1Trap");
OctetStr tag("v1trap");
OctetStr address;
IpAddress ip(addr);
for (int i=0; i<4; i++) {
address += (unsigned char)ip[i];
}
address += (addr.get_port() >> 8);
address += (addr.get_port() & 0x00FF);
if (snmpTargetParamsEntry::instance->add_entry(name, // row index
0, // mpModel
1, // securityModel
"public", // secName
1)) { // secLevel
snmpNotifyEntry::instance->add_entry(name, // row index
tag, // tag
1); // type (trap)
}
if (snmpTargetAddrEntry::instance->
add_entry(UdpAddress(addr).get_printable(), // row index <-- THE CHANGE
Oidx("1.3.6.1.6.1.1"), // UDP domain
address, // target address
tag, // tag
name)) // params entry
return TRUE;
return FALSE;
}
Best regards,
Frank
"Vasay, Al" wrote:
> Hi Frank,
>
> How do I add a second trap recipient? I can send a trap to "10.9.32.115" by doing the following:
>
> Vbx* vbs = 0;
> coldStartOid coldOid;
> NotificationOriginator no;
> UdpAddress dest("10.9.32.115/162"); // Specify trap recipient
> no.add_v1_trap_destination(dest);
> no.generate(vbs, 0, coldOid, "", "");
>
> But how do I send the trap to "10.9.32.115" and "10.9.32.191"?
>
> I was looking at the notification_originator.cpp and learned that it's adding the IP Address to the targetParamsEntry, snmpNotifyEntry and snmpTargetAddrEntry tables whenever I call NotificationOriginator::add_v1_trap_destination. So, I thought that I can add the second recipient by doing the following:
>
> Vbx* vbs = 0;
> coldStartOid coldOid;
> NotificationOriginator no;
> UdpAddress dest("10.9.32.115/162"); // Specify trap recipient
> no.add_v1_trap_destination(dest);
> UdpAddress dest2("10.9.32.191/162"); // Add second recipient
> no.add_v1_trap_destination(dest2);
> no.generate(vbs, 0, coldOid, "", "");
>
> But it didn't work. The trap got sent only to "10.9.32.115". What should I be doing?
>
> Thanks,
> Al Vasay
--
Frank Fock - AGENT++
Email: frank____fock.de
Fax: +49 7195 177108
More information about the AGENTPP
mailing list