Lamp Based NagiosXI

Opsgenie provides a Nagios XI Integration package that utilizes full capabilities of Opsgenie, including rich alerts with charts, the automated closing of alerts, and bi-directional integration with Nagios.

When installed and appropriately configured, the plugin creates Opsgenie alerts when a Nagios XI notification is sent, and attaches extra information (status, alert histogram, trends, etc. ) related with the relevant host or service. This extra information can be viewed with the alert directly from Opsgenie apps.

Installation

The steps below describe how to integrate Opsgenie and Nagios using Opsgenie Nagios XI integration plugin. Note that you may need to slightly alter these instructions depending on your exact Linux distribution and your Nagios XI configuration.

🚧

This document contains only specific instructions for deprecated Nagios integration. For other steps please refer to the new Nagios Integration's document.

Prerequisites

Packages are provided for Red Hat and Debian based linux distributions. Opsgenie Nagios XI Plugin is a java application therefore requires the Java Runtime version 1.6+ Both the Open JDK and Oracle JVMs can be used. You must have the JAVA_HOME environment variable defined in your environment.

πŸ“˜

Ensure that JAVA_HOME environment variable is set. If it is not, you may set it by removing the comment at the begining of the following line in /etc/opsgenie/profile file and set JAVA_HOME to your JRE installation directory.
#JAVA_HOME=<path/to/JDK or JRE/install>

Add NagiosXI Integration in Opsgenie

To add Nagios XI integration in Opsgenie, go to Opsgenie Nagios XI Integration page

Click on "Save Integration" button to save the integration. An "API Key" is generated for the integration. This key will be used by Nagios XI to authenticate with Opsgenie and specify the integration that should be used to process Nagios XI alerts.

1031

Opsgenie Nagios Plugin Configuration

The plugin uses lamp (included in the plugin) to create, acknowledge and close alerts in Opsgenie. Lamp is a command line utility that interfaces with Opsgenie services via HTTPS. Lamp can be used to work with alerts, enable/disable policies and integrations, etc. Nagios XI is configured to use lamp to create, acknowledge and close alerts in Opsgenie.

Lamp configuration parameters can be found at /etc/opsgenie/conf/opsgenie-integration.conf file.

Configuration ParametersMandatory to fill
apiKeyCopy the API key from the Nagios XI integration you've created above. Lamp uses this key to authenticate to Opsgenie. API key is also used to identify the right integration configuration that should be used to process the alerts forwarded by lamp.Yes
nagios.nagiosServernagiosServer field is used to identify the Nagios XI server in Opsgenie, and only required when there are multiple Nagios XI servers. This field is used by Opsgenie when sending actions executed by users (acknowledge, close, etc.) back to your Nagios XI servers via Marid.Optional
nagios.attachFilesEnable/disable attaching histogram and trend images to alerts.Optional
nagios.alert_histogram_image_urlURL to retrieve nagios histogram images. You need to replace localhost with your nagios server address.Optional
nagios.trends_image_urlURL to retrieve nagios trends images. You need to replace localhost with your nagios server address.Optional
nagios.command_urlURL to update Nagios XI alerts when alerts get acknowledged, commented, etc.Optional
nagios. user





nagios.ticket
Credentials to authenticate Nagios web server to get nagios histogram and trends images. Please follow below steps to get credentials:
Go to Nagios XI Admin >> Manage Components >> Backend API URL page.
Select a user from Account Selection and click Apply Settings.
Copy ticket information in one of the listed Backend API URLs.
Optional
nagios.http.timeouttimeout duration in msecs to get nagios histogram and trends images.Optional
1005

πŸ“˜

Instead of implementing all logic in the shell script, the integration package provides a script (/var/opsgenie/lamp/scripts/ogCreateAlert.groovy) written in groovy - a powerful JAVA based scripting language- which can be executed by lamp. In short, the script creates an Opsgenie alert, retrieve alert histogram and trends of the relevant host or service through Nagios XI PHPs, creates an HTML file which displays the status of the entity when the notification occurs, and attaches it to the alert. The script works as is, but can be further customized as needed.

Troubleshooting Guide

If the integration works as expected, when a host or service state becomes down in Nagios XI, an alert will be created in Opsgenie. When the host or service comes back up, the alert in Opsgenie will get closed automatically as well.

Verify that lamp can access Opsgenie
Create a test alert in Opsgenie using lamp from the shell.

lamp createAlert --message "nagios test alert" --recipients nobody

Check whether the alert is created in Opsgenie. If not, check the logs for lamp utility in the /var/log/opsgenie/lamp directory for any error messages. If you see "JAVA_HOME not defined" error in opsgeniescripter or opsgeniescriptout logs, you should define it in /etc/opsgenie/profile shell script.

Verify Nagios XI is able to create alerts in Opsgenie
Check whether there are alert from Nagios XI in Opsgenie. If Nagios XI is generating alerts, but alerts are not being created in Opsgenie, check the logs for lamp utility in the /var/log/opsgenie/lamp directory for any error messages.

πŸ“˜

If there are no logs, ensure that the nagios user has permission to write to the /var/log/opsgenie/lamp directory.

Verify graphs are attached to the alerts
Plugin retrieves relevant graphs from the Nagios XI server via HTTP(S) and attaches them to the alert. If the alerts in Opsgenie do not include these graphs as attached files, it may be due to the plugin not able to access to the Nagios XI server. Check whether the specified URLs in the configuration file are correct. Check whether these files can be retrieved using curl, etc.

Check the logs for lamp utility in the /var/log/opsgenie/lamp directory for any error messages. If you see any errors in logs, don't hesitate to contact us.