Notification Configuration How-To

From OpenNMS
Jump to: navigation, search

Originally written by Tarus Balog tarus@opennms.org. This page based on v1.0 from November 2002.


See also: Configuring notifications


Introduction

Purpose

This How-To is one in a series designed to serve as a reference for getting started with OpenNMS. Eventually, these documents will cover everything necessary to get OpenNMS installed and running in your environment.

Copyright

Content is available under a Creative Commons Attribution-NonCommercial-ShareAlike2.5 License.

Corrections and Omissions

Please submit any corrections and omissions to the author.

Overview

OpenNMS has three main functional areas:

  • Determining Availability of Network Services (discussed in part 3 of this series)
  • Gathering Performance Data via SNMP (discussed in part 4 of this series)
  • Event Management and Notifications

The last area: Event Management and Notifications, is the subject of this How-To.

One might also look at the README.notification file (in /opt/OpenNMS/etc), for some more info about the configuration of the notification subsystem.

Notifications Strategies

SnmpTrapNotificationStrategy

Here is how this is setup. This configuration sends an OpenNMS trap with the nodelabel in the varbind. This strategy needs addtional work and probably a new use case.

   <notification name="snmpTrap" status="on">
       <uei>uei.opennms.org/nodes/nodeDown</uei>
       <rule>IPADDR IPLIKE *.*.*.*</rule>
       <destinationPath>trapNotifier</destinationPath>
       <text-message>
               All services are down on node %nodeid%.
       </text-message>
       <subject>node %nodeid% down.</subject>
       <numeric-message>111-%noticeid%</numeric-message>
       <parameter name="trapVersion" value="v1" />
       <parameter name="trapTransport" value="UDP" />
       <parameter name="trapHost" value="my-trap-host.mydomain.org" />
       <parameter name="trapPort" value="162" />
       <parameter name="trapCommunity" value="public" />
       <parameter name="trapEnterprise" value=".1.3.6.1.4.1.5813" />
       <parameter name="trapGeneric" value="6" />
       <parameter name="trapSpecific" value="1" />
       <parameter name="trapVarbind" value="Node: %nodelabel%" />
   </notification>


The parameters defined here are passed to the notification command as switches. You will see in the notificationCommands.xml file:

    <command binary="false">
        <name>snmpTrap</name>
        <execute>org.opennms.netmgt.notifd.SnmpTrapNotificationStrategy</execute>
        <comment>Class for sending notifications as SNMP Traps</comment>
        <argument streamed="false">
                <switch>trapVersion</switch>
        </argument>
        <argument streamed="false">
                <switch>trapTransport</switch>
        </argument>
        <argument streamed="false">
                <switch>trapHost</switch>
        </argument>
        <argument streamed="false">
                <switch>trapPort</switch>
        </argument>
        <argument streamed="false">
                <switch>trapCommunity</switch>
        </argument>
        <argument streamed="false">
                <switch>trapEnterprise</switch>
        </argument>
        <argument streamed="false">
                <switch>trapGeneric</switch>
        </argument>
        <argument streamed="false">
                <switch>trapSpecific</switch>
        </argument>
        <argument streamed="false">
                <switch>trapVarbind</switch>
        </argument>
    </command>

Any or none of these parameters and switches can be defined, however, if you define it as a parameter in the notification, you must define it as a switch in the notification command. The defaults are:

trapVersion="v1" ("v1 or "v2c")
trapTransport="UDP" (only UDP for now)
trapHost="127.0.0.1" (any valid hostname or ip address)
trapPort="162" (any valid IP port)
trapCommunity="public" (any valid community string)
trapEnterprise=".1.3.6.1.4.1.5813" (any valid OID)
trapGeneric="6" (any valid generic ID)
trapSpecific="1" (any valid trapSpecific ID)
trapVarbind="OpenNMS Trap Notification" (any string or one or more valid %<event field>% such as "%eventUEI%" in the string)

The one allowed trap varbind will be sent with the object id of ".1.3.6.1.4.1.5813.20.1" and the object type of "DisplayString".