[AGENT++] Notification Filter configuration
Sardari, Darren
dsardari at harris.com
Fri Jun 10 18:32:19 CEST 2011
Formatting for the second portion was screwed up. Hopefully this is more readable:
//Filter Table
snmpNotifyFilterEntry *filterTable = (snmpNotifyFilterEntry*)mib->get("1.3.6.1.6.3.13.1.3.1");
MibTableRow* filterRow;
//Filter .50 from Reconfig Traps
index = Oidx::from_string("filter1", TRUE);
index+= Oidx::from_string(notificationOid, FALSE);
if(filterTable->find_index(index))
{
printf("filterTable already has index of %s\n",(index.as_string()).get_printable());
}
else
{
filterRow = filterTable->add_row(index);
if(filterRow)
{
filterRow->get_nth(0)->replace_value(new OctetStr(""));
filterRow->get_nth(1)->replace_value(new SnmpInt32(2));
filterRow->get_nth(2)->replace_value(new SnmpInt32(3));
filterRow->get_nth(3)->replace_value(new SnmpInt32(1));
}
else
{
printf("filterRow: Could not add Row\n");
}
}
-----Original Message-----
From: agentpp-bounces at agentpp.org [mailto:agentpp-bounces at agentpp.org] On Behalf Of Sardari, Darren
Sent: Friday, June 10, 2011 9:33 AM
To: agentpp at agentpp.org
Subject: [AGENT++] Notification Filter configuration
I'm having a little trouble setting up a filter for Notifications. I wrote this code real quick to try and test it out. I'm just trying to exclude some notifications I created from the manager but it seems like I am filtering all notifications (even the coldstart).If anyone can point me in the right direction, it would be greatly appreciated.
Thanks,
Darren Sardari
Code:
no.add_v3_trap_destination(dest, "defaultV3Trap", "v3trap", "test");
//Filter Profile Table
snmpNotifyFilterProfileEntry *filterProfileTable = (snmpNotifyFilterProfileEntry*)mib->get("1.3.6.1.6.3.13.1.2.1");
MibTableRow* filterProfileRow;
Oidx index = Oidx::from_string("defaultV3Trap", FALSE);
if(filterProfileTable->find_index(index))
{
printf("filterProfileTable already has index of %s\n",(index.as_string()).get_printable());
}
else
{
//Filter for .50
filterProfileRow = filterProfileTable->add_row(index);
if(filterProfileRow)
{
filterProfileRow->get_nth(0)->replace_value(new OctetStr("filter1"));
//filterProfileRow->get_nth(1)->replace_value(new SnmpInt32(3));
filterProfileRow->get_nth(2)->replace_value(new SnmpInt32(1));
}
else
{
printf("filterProfileRow: Could not add Row\n");
}
}
//Filter Table
snmpNotifyFilterEntry *filterTable = (snmpNotifyFilterEntry*)mib->get("1.3.6.1.6.3.13.1.3.1");
MibTableRow* filterRow;
//Filter .50 from notifications
index = Oidx::from_string("filter1", TRUE);
index+=Oidx::from_string(notificationOid, FALSE);
if(filterTable->find_index(index)){ printf("filterTable already has index of %s\n",(index.as_string()).get_printable());}else{ filterRow = filterTable->add_row(index); if(filterRow) { filterRow->get_nth(0)->replace_value(new OctetStr("")); filterRow->get_nth(1)->replace_value(new SnmpInt32(2)); filterRow->get_nth(2)->replace_value(new SnmpInt32(3)); filterRow->get_nth(3)->replace_value(new SnmpInt32(1)); } else { printf("filterRow: Could not add Row\n"); }}
_______________________________________________
AGENTPP mailing list
AGENTPP at agentpp.org
http://lists.agentpp.org/mailman/listinfo/agentpp
More information about the AGENTPP
mailing list