Can't get notification filtering on varbind working / lack of good documentation on this feature
Description
I'm trying to filter a notification based on SNMP parameters.
On the wiki, I have found:
"If the notification has a <varbind> configured with a name and value, it is used for a case sensitive match against the beginning an event parameter of the same name."
<notification name="layer2SnmpInterfaceDown" status="on" writeable="yes"> <uei xmlns="">uei.opennms.org/nodes/snmp/interfaceOperDown</uei> <rule xmlns="">IPADDR like '10.6.%'</rule> <destinationPath xmlns="">Email-support</destinationPath> <text-message xmlns="">Operational status Down on interface ifname:%parm[snmpifname]% on node %nodelabel%.</text-message> <subject xmlns="">Notice #%noticeid%: ifname:%parm[snmpifname]% on node %nodelabel% down.</subject> <varbind> <vbname>snmpifname</vbname> <vbvalue>ge-0/1/</vbvalue> </varbind>
But it doesn't work. For example, I received the following notification:
-------- Message original --------
Sujet: Notice #3198: interface ge-0/0/3 on node XXXXXXXXXXXX is down. Date : Tue, 20 Dec 2011 12:38:16 +0100 (CET) De : opennms@XXXXXXXXX Pour : opennms-ntest@XXXXXXXXXX
Operational status Down on interface ge-0/0/3 on node XXXXXXXXXXX.
Agent Interface Down (linkDown Trap) on interface index:508; ifDescr: ge-0/0/3; ifName:ge-0/0/3; ifAlias:test-guest Description A linkDown trap signifies that the sending protocol entity recognizes a failure in one of the communication link represented in the agent's configuration. Instance: 508 IfDescr: ge-0/0/3 IfName: ge-0/0/3 IfAlias: test-guest
I tried changing <vbname>snmpifname</vbname> to <vbname>IfName</vbname> with no success neither
Any idea what is going on here?
Cyrille
Acceptance / Success Criteria
None
Lucidchart Diagrams
Activity
Cyrille Bollu December 23, 2011 at 5:50 AM
Sorry it's my mistake.
Cyrille
Cyrille Bollu December 23, 2011 at 5:49 AM
Hi Alejandro,
I'm sorry, I made a mistake; I was confused with another notification definition.
OpenNMS works as expected.
All my apologies,
Cyrille
Alejandro Galue December 21, 2011 at 9:43 AM
Based on the code for NotifdConfigManager, you should use the exact name of the event parameter, and for the value, use the exact name of the alias or just the first part of it. In notifications, the regex are not supported right now:
I'm trying to filter a notification based on SNMP parameters.
On the wiki, I have found:
"If the notification has a <varbind> configured with a name and value, it is used for a case sensitive match against the beginning an event parameter of the same name."
(cfr http://www.opennms.org/wiki/Configuring_notifications)
So, I set
<notification name="layer2SnmpInterfaceDown" status="on" writeable="yes">
<uei xmlns="">uei.opennms.org/nodes/snmp/interfaceOperDown</uei>
<rule xmlns="">IPADDR like '10.6.%'</rule>
<destinationPath xmlns="">Email-support</destinationPath>
<text-message xmlns="">Operational status Down on interface ifname:%parm[snmpifname]% on node %nodelabel%.</text-message>
<subject xmlns="">Notice #%noticeid%: ifname:%parm[snmpifname]% on node %nodelabel% down.</subject>
<varbind>
<vbname>snmpifname</vbname>
<vbvalue>ge-0/1/</vbvalue>
</varbind>
But it doesn't work. For example, I received the following notification:
-------- Message original -------- Sujet: Notice #3198: interface ge-0/0/3 on node XXXXXXXXXXXX is down.
Date : Tue, 20 Dec 2011 12:38:16 +0100 (CET)
De : opennms@XXXXXXXXX
Pour : opennms-ntest@XXXXXXXXXX
Operational status Down on interface ge-0/0/3 on node XXXXXXXXXXX.
After googling a little, I tried this:
<vbname>snmpifname</vbname>
<vbvalue>~ge-0\/1</vbvalue>
With no success neither
As the event had the following:
Agent Interface Down (linkDown Trap) on interface index:508; ifDescr: ge-0/0/3; ifName:ge-0/0/3; ifAlias:test-guest
Description
A linkDown trap signifies that the sending protocol entity recognizes a failure in one of the communication link represented in the agent's configuration.
Instance: 508
IfDescr: ge-0/0/3
IfName: ge-0/0/3
IfAlias: test-guest
I tried changing <vbname>snmpifname</vbname> to <vbname>IfName</vbname> with no success neither
Any idea what is going on here?
Cyrille