RT Integration

From OpenNMS

Contents

RT Integration

Integeration with RT can be enabled with the new HTTP Notification Strategy in OpenNMS (1.3.x).
Note: The URL specified in this example doesn't reference a standard CGI that comes with RT, it is modified RT integration script that returns a status (OK | ERROR) and the ticket number assigned by RT.

Alarms and Tickets

Here is the configuration used in the OpenNMS JUnit Testing of the new notification strategy.

destinationPaths.xml

The destinationPaths.xml file is the file that binds the notification command with the entities (users/groups) to be notified. This integration example shows the Admin user getting notified with the rt command:

<path name="rtPath">
  <target>
    <name>Admin</name>
    <command>rtPost</command>
  </target>
</path>

Just a comment.

notifications.xml

The notifications.xml file identifies the event, nodes, destinationPath, and parameters for the notification. The parameter list must match the parameter list (or be a subset of) the list of arguments configured for the notificationCommand (see below). The HTTP notification strategy will process each parameter prefixed with "post-" as form input to the specified URL.

An optional "sql" parameter can be specified and be used to update a column in the "opennms" database. The "${1}" token is replaced with the first back reference of a matching reqular expression. The reqular expression specified as the value of "result-match" parameter is compared to the text returned from the HTTP Post.

    <!-- Sample notification using HTTP Post -->
    <notification name="rtNodeDown" status="on" >
      <uei>uei.opennms.org/nodes/nodeDown</uei>
      <rule>IPADDR IPLIKE *.*.*.*</rule>
      <destinationPath>rtPath</destinationPath>
      <text-message>All services are down on node %nodeid%</text-message>
      <subject>node: %nodeid% down</subject>
      <parameter name="url" value="http://172.16.8.68/cgi-bin/noauth/nmsgw.pl" />
      <parameter name="timeout" value="2000" />
      <parameter name="retries" value="1" />
      <parameter name="post-NodeID" value="%nodeid%" />
      <parameter name="post-event" value="%eventid%" />
      <parameter name="post-nasid" value="%nodelabel%" />
      <parameter name="post-queue" value="ZZ_Test" />
      <parameter name="post-message" value="All services are down on node: %nodelabel%" />
      <parameter name="result-match" value="(?s).*OK\s+([0-9]+).*" />
      <parameter name="sql" value="UPDATE alarms SET tticketID=${1} WHERE lastEventID = %eventid%" />
    </notification>

notificationCommands.xml

The notificationCommands.xml file defines the different commands that can be used when configurating a notification in notifications.xml.

    <!-- Use this notificationCommand to create a ticket in RT with an HTTP Post -->
    <command binary="false">
        <name>rtPost</name>
        <execute>org.opennms.netmgt.notifd.HttpNotificationStrategy</execute>
        <comment>Class for sending notifications with an HTTP Post</comment>
        <argument streamed="false">
                <switch>url</switch>
        </argument>
        <argument streamed="false">
                <switch>timeout</switch>
        </argument>
        <argument streamed="false">
                <switch>retries</switch>
        </argument>
        <argument streamed="false">
                <switch>-tm</switch>
        </argument>
        <argument streamed="false">
                <switch>result-match</switch>
        </argument>
        <argument streamed="false">
                <switch>sql</switch>
        </argument>
        <argument streamed="false">
                <switch>post-NodeID</switch>
        </argument>
        <argument streamed="false">
                <switch>post-event</switch>
        </argument>
        <argument streamed="false">
                <switch>post-nasid</switch>
        </argument>
        <argument streamed="false">
                <switch>post-queue</switch>
        </argument>
        <argument streamed="false">
                <switch>post-message</switch>
        </argument>
    </command>
Personal tools
DevJam 2008 Sponsors
DevJam 2008 Sponsor: Google
DevJam 2008 Sponsor: Netregistry
DevJam 2008 Sponsor: Papa John's
NewEdge Networks
OpenNMS takes home the gold award!
Join the Free Software Foundation
Support This Project Commercial OpenNMS Support OpenNMS Italia Get OpenNMS at SourceForge.net. Fast, secure and Free Open Source software downloads Our Network Simulator Our Java Profiler