Welcome to Questions - Ask OpenNMS, where you can ask questions and receive answers from other members of the community.

How to associate a trap to a node based on a parameter field in the trap?

0 votes
1,571 views

Open NMS is up and running. It is receiving traps from an Internation Lighting MON-950. The MON-950 is NAT behind a cellular modem. The Cellular modem has a public IP, the MON-950 has a private IP (192.168.1.191). 

The trap look like this:

DefaultEventHandlerImpl: Event {
DefaultEventHandlerImpl:   uuid  = <not-set>
DefaultEventHandlerImpl:   uei   = uei.opennms.org/vendor/ITL/traps/alarm-trap
DefaultEventHandlerImpl:   src   = trapd
DefaultEventHandlerImpl:   iface = 192.168.1.191
DefaultEventHandlerImpl:   time  = Monday, October 20, 2014 8:40:01 PM GMT
DefaultEventHandlerImpl:   parms {
DefaultEventHandlerImpl:     (.1.3.6.1.4.1.35367.4.1.1.4.2, MON-950:York NE Bypass:Strobe Alarm:Major)
DefaultEventHandlerImpl:   }
DefaultEventHandlerImpl: }
JdbcEventWriter: JdbcEventWriter: processing uei.opennms.org/vendor/ITL/traps/alarm-trap nodeid: 0 ipaddr: 192.168.1.191 serviceid: null time: Monday, October 20, 2014 8:40:01 PM GMT
JdbcEventWriter: DBID: 569
JdbcEventWriter: SUCCESSFULLY added uei.opennms.org/vendor/ITL/traps/alarm-trap related  data into the EVENTS table.
JdbcEventWriter: EventWriter finished for : uei.opennms.org/vendor/ITL/traps/alarm-trap
EventIpcManagerDefaultImpl: Event ID 569 to be broadcasted: uei.opennms.org/vendor/ITL/traps/alarm-trap
EventIpcManagerDefaultImpl: No listener interested in event ID 569: uei.opennms.org/vendor/ITL/traps/alarm-trap
 
I was able to discover the node, but it has the public IP Address of the Cellular modem. 
 
So the trap is not associated with the node.
 
How can I configure the system to associate the trap with the node based on the information in the parm field in the trap.
Node id 2 is the node that should be associated with the trap received.
 
parm infomation:
parms { (.1.3.6.1.4.1.35367.4.1.1.4.2, MON-950:York NE Bypass:Strobe Alarm:Major) }

MON-950 = device type

York NE Bypass = node label

Strobe Alarm = alarm type

Major = severity

Thanks for the help

John

OpenNMS version
1.12.9
Java version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Server VM (build 24.71-b01, mixed mode)
Operating system
2.6.32-279.2.1.el6.i686, CentOS release 6.3
PostgreSQL version
psql (PostgreSQL) 8.4.20
asked Oct 29, 2014 by jwmahaffey (180 points)
edited Jan 9, 2015 by indigo
Changed topic from "Can someone help a new user" to "How to associate a trap to a node based on a parameter field in the trap?" to be more explanatory

1 Answer

0 votes
Hey jwmahaffey,

do you know the event translator? http://www.opennms.org/wiki/EventTranslator
answered Nov 1, 2014 by mfuhrmann (7,350 points)
Thank you for pointing me in the right direction.
John
Is your question answered? If so, please mark as answered. Thanks.
I made the configuration changes to the translator-configuration.xml file.

<event-translation-spec uei="uei.opennms.org/vendor/ITL/traps/alarm-trap">
      <!-- Each event can have 1 or more mappings. -->
      <mappings>
        <mapping>
          <!-- This mapping uses the SQL value type to query the DB and change the nodeid of the new event -->
          <assignment type="field" name="nodeid">
            <value type="sql" result="select node.nodeid from node, ipInterface where ipinterface.ipaddr=? and node.nodeLabel=? and node.nodeId=ipinterface.nodeid and ipInterface.isManaged != 'D' and node.nodeType != 'D'" >
              <!-- These are sub value types that are used as parameters to the above sql as in JDBC speak -->
              <value type="parameter" name=".1.3.6.1.4.1.35367.4.1.1.4.2" matches="^([0-9]+).* ([A-z]+)" result="${1}-${2}" />
             <!-- <value type="constant" result="166.130.101.161" /> -->
            </value>
          </assignment>
        </mapping>
      </mappings>
    </event-translation-spec>

Here is the log information showing the trap coming in.

2014-11-19 09:26:29,393 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] DefaultEventHandlerImpl: Event {
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] DefaultEventHandlerImpl:   uuid  = <not-set>
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] DefaultEventHandlerImpl:   uei   = uei.opennms.org/vendor/ITL/traps/alarm-trap
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] DefaultEventHandlerImpl:   src   = trapd
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] DefaultEventHandlerImpl:   iface = 192.168.1.191
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] DefaultEventHandlerImpl:   time  = Wednesday, November 19, 2014 2:26:29 PM GMT
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] DefaultEventHandlerImpl:   parms {
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] DefaultEventHandlerImpl:     (.1.3.6.1.4.1.35367.4.1.1.4.0, 166.130.101.161:York NE Bypass:MON-950 Cold Start:Restore)
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] DefaultEventHandlerImpl:   }
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] DefaultEventHandlerImpl: }
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] JdbcEventWriter: JdbcEventWriter: processing uei.opennms.org/vendor/ITL/traps/alarm-trap nodeid: 0 ipaddr: 192.168.1.191 serviceid: null time: Wednesday, November 19, 2014 2:26:29 PM GMT
2014-11-19 09:26:29,395 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] JdbcEventWriter: DBID: 26509
2014-11-19 09:26:29,406 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] JdbcEventWriter: SUCCESSFULLY added uei.opennms.org/vendor/ITL/traps/alarm-trap related  data into the EVENTS table.
2014-11-19 09:26:29,413 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] JdbcEventWriter: EventWriter finished for : uei.opennms.org/vendor/ITL/traps/alarm-trap
2014-11-19 09:26:29,413 DEBUG [EventIpcManagerDefaultImpl-Thread-3-of-5] EventIpcManagerDefaultImpl: Event ID 26509 to be broadcasted: uei.opennms.org/vendor/ITL/traps/alarm-trap

Seems that I am still missing something.

Thanks
John
...