OpenNMS Integration package will not be served for a while. Hence, "Scenario 2: Rich Alert Integration" will be unavailable during this time.
OpsGenie enables OpenNMS users to receive OpenNMS events (referred to as alerts in OpsGenie) through email, SMS, phone call, and iPhone/Android push notifications and works with OpenNMS events from mobile phones. OpsGenie alerts contain not only the event but also supporting information such as managed object details, performance charts, etc. enabling users to make better decisions when notified.
OpsGenie provides various integration tools and APIs to integrate monitoring tools with OpsGenie so that users are notified when something important occurs in their environment. Use the following integration scenarios and packages provided by OpsGenie as a starting point to integrate OpenNMS with OpsGenie alerting system.
OpenNMS has the capability to send emails to notify users for specified events. Using OpsGenie's email integration capabilities, OpsGenie notifies users via SMS, iPhone or Android push notifications, or phone calls. Instructions below describe how to configure OpenNMS and OpsGenie to send push notifications to iPhone/Android apps using OpsGenie email integration for OpenNMS authentication failed events as an example.
- Please create an OpsGenie account if you haven't done so already.
- Setup OpsGenie email rules which create alerts from emails sent from OpenNMS. When your account is created OpsGenie provides a default email address and a default email rule for you. Modify your email address and rules in the Settings page. For this setup the default rules are used, which creates alerts for every incoming mail. Find more information on email integration here.
- Add an OpsGenie Email Integration.
- Copy the email address from the OpsGenie Email Integration.
- Click Save Integration.
- Create a user account for OpsGenie integration in OpenNMS web UI. Click the Admin link in the menu bar.
- Go to "Configure Users, Groups and On-Call Roles".
- Click Configure Users.
- Click Add New User, type "OpsGenie" in the username field and provide a password in the form.
- Click OK.
- Paste the email copied previously to the Email field in the OpenNMS user form.
- Click Finish.
To receive a notification from OpenNMS, your user or a group that your user is in needs to be a part of a destination path.
- Go to the "Admin" page.
- Click Configure Notifications in the "Operations" section, then "Configure Destination Paths," then click New Path.
- Give it a name, like "OpsGenieEmailPath", then click Edit.
- Add "OpsGenie" user by selecting it, then click Next >>>.
- On the next page, leave the defaults ("javaEmail" and "on") and click Next >>> again.
- Click Finish and you should see your new destination path in the "Existing Paths" section.
Next, associate OpenNMS events with the new destination path.
- Go to the "Admin" page,
- Click Configure Notifications in the "Operations" section, then Configure Event Notifications.
- Click Add New Event Notification at the top of the "Event Notifications" page.
- Select "OpenNMS-defined internal event: an authentication failure has occurred in WebUI" event for the time being to test the setup easily. This configuration can be changed later if desired.
- Click Next >>>.
- Click Skip results validation >>> on the next page.
Finally, configure the information used to send the notification. Fill in the following values:
Name: Authentication Failed
Choose A Path: OpsGenieEmailPath
Text Message: The OpenNMS Web UI had a failed login attempt, by user '%parm[user]%', from IP address %parm[ip]%
Short Message: Authentication failed by user '%parm[user]%'
Email Subject: Authentication failed by user '%parm[user]%'
- Click Finish. Now notification events appear in the list, but are disabled.
- Set the radio button to On to enable it. In the main OpenNMS Admin page, there is a radio selector labeled, "Notification Status." Change it to On.
- Click Update.
- Configure the mail server in $OPENNMS_HOME/etc/javamail-configuration.properties file and restart OpenNMS server.
Now the setup is completed to create an OpenNMS event and receive an OpsGenie push notification.
Logout from OpenNMS web UI and try to login with an invalid account. A push notification is sent, if not delivered, take a look at "$OPENNMS_HOME/logs/daemon/notifd.log" and see if an error message occurs. If no problem exists, look at OpsGenie alerts page and check whether the new alert exists in the alert list.
Access more information on OpenNMS notifications in the following pages:
OpenNMS notification system allows executing arbitrary external programs, which opens endless possibilities to integrate with OpsGenie alerting system through OpsGenie client tools like Lamp, Marid, etc. OpsGenie provides a downloadable OpenNMS integration package which shows rich alerting capabilities of our system. Integration files include example groovy script that forwards node events, script also retrieves most recent node outages to the alert from OpenNMS and attaches to the alert to make this information available to the recipients.
- Download OpsGenie OpenNMS Integration files that include:
- Lamp - OpsGenie command line utility to create alerts
- OpenNMS Integration scripts
- Unzip OpenNMS Integration
- Lamp installation:
- OpenNMS Integration Files contains a customized version of Lamp , install this version.
- Install lamp by referring to Lamp Documentation - Installation steps. Do not download lamp again.
- Make sure the OpenNMS shell scripts have correct LAMP_HOME, the lamp installation directory.
- Create an OpsGenie API Integration, copy the integration apiKey, put into the opsgenie-integration/conf/opsgenie-integration.conf file.
- Verify Lamp is working: Create a test alert, using the lamp utility from the command line, make sure your alert is visible on OpsGenie dashboard. Please refer to Lamp Documentation for more information.
- Groovy script configuration: Instead of implementing all logic in the shell script, the integration package provides a script (ogCreateAlert.groovy) written in groovy - a powerful Java-based scripting language- which can be executed by Lamp. Briefly, the script creates an OpsGenie alert, retrieves node outages through OpenNMS rest API, creates an HTML file showing the outages and attaches it to the alert.
- RECIPIENTS: Users or group of users who will be notified by OpsGenie. Defaults to "all".
- SOURCE: Alert source
- OPENNMS_USER and OPENNMS_PASSWORD: Credentials to authenticate OpenNMS rest API.
- OPENNMS_HOST and OPENNMS_PORT: OpenNMS web server host and port which is used for REST API calls.
/********************CONFIGURATIONS****************************/ // Recipients should be specified here for automatic tools. // Recipients can be users or groups created in OpsGenie RECIPIENTS="all" SOURCE="OpenNMS" //OpenNMS credentials are needed for extra information to be fetched through REST API OPENNMS_USER = "admin" OPENNMS_PASSWORD = "admin" OPENNMS_HOST="localhost" OPENNMS_PORT=8980
- Prepare opennmsShellScripts/opsgenie shell script :
- Copy the shell script anywhere in the same system where OpenNMS installed. This path is pointed to when OpenNMS notification commands are configured.
- Configure LAMP_HOME to point your lamp installation directory.
- Make the script executable in linux (chmod +x)
- Prepare OpsGenie Groups & Users
- Create groups or users that you want to notify from Smarts
- Make sure groups have at least one user
- Add a custom notification command by adding the following section to the $OPENNMS_HOME/etc/notificationCommands.xml configuration file. Check OpenNMS Notification Configuration document for details.
<command binary="true"> <name>OpsGenie</name> <execute>/usr/bin/opsgenie</execute> <comment>OpsGenie alert creation</comment> <argument streamed="false"> <switch>-subject</switch> </argument> <argument streamed="false"> <switch>-tm</switch> </argument> <argument streamed="false"> <switch>-nodeid</switch> </argument> </command>
- Modify the tag so that it points the shell script provided with OpsGenie integration package.
- Restart OpenNMS server.
- Add an OpenNMS user and give it a name like "OpsGenie".
- The user added should be a part of a destination path so that the shell script provided can be executed with OpenNMS.
- Go to the Admin page, click Configure Notifications in the "Operations" section.
- Click Configure Destination Paths,
- Click New Path. Give it a name, like "OpsGenieScriptPath", then click Edit.
- Add the user by selecting it, then click Next >>>.
- On the next page, check the "OpsGenie" custom command and on.
- Click Next >>> again.
- Finally, click Finish. Now the new destination path appears in the "Existing Paths" section.
- Go to the Admin page.
- Click Configure Notifications in the "Operations" section.
- Click Configure Event Notifications.
- Click *Add New Event Notification at the top of the Event Notifications page and select "OpenNMS-defined node event: nodeLostService" event.
- Click Next >>>.
- Click Skip results validation >>> on the next page. Configure the information used to send the notification. Fill in the following values:
- Name: Node Lost Service
- Choose A Path: OpsGenieShellPath
- Text Message: The %service% service poll on interface %interfaceresolve% (%interface%) on node %nodelabel% failed at %time%.
- Short Message: %service% down on %interfaceresolve% (%interface%) on node %nodelabel%.
- Email Subject: %service% down on %interfaceresolve% (%interface%) on node %nodelabel%.
- Click "Finish".
- The notification event in the list will be disabled. Set the radio button to "On" to enable it.
- In the main OpenNMS Admin page, there is a radio selector labeled, "Notification Status." Change it to "On" and click update.
To test the integration package, make the OpenNMS server to scan the local PC which runs an HTTP server on port 8080, with the following command:
perl $OPENNMS_HOME/bin/send-event.pl --interface 192.168.1.102 uei.opennms.org/internal/discovery/newSuspect
After the scan completed OpenNMS creates the node, its interfaces, and services including the HTTP server.
When the HTTP server is shut down, OpenNMS detects it in the next service poll and creates a "nodeLostService" event for it.
The event triggers the notification system which executes the shell script installed. As a result a new alert is created in OpsGenie system and most recent outages of my PC are displayed in the OpsGenie console.
Updated 10 months ago