• Get started
  • Documentation

Integrate Opsgenie with Lamp Based NagiosXI

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 Nagios XI Integration in Opsgenie

  1. To add Nagios XI integration in Opsgenie, go to Settings > Integrations. Search for Nagios XI, then select Add.

  2. Edit the integration detail, then select Save integration. We’ll generate an API key for this 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.

NagiosXI integration

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 Parameters

 

Mandatory to fill

apiKey

Copy 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.nagiosServer

nagiosServer 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.

Optional

nagios.attachFiles

Enable/disable attaching histogram and trend images to alerts.

Optional

nagios.alert_histogram_image_url

URL to retrieve nagios histogram images. You need to replace localhost with your nagios server address.

Optional

nagios.trends_image_url

URL to retrieve nagios trends images. You need to replace localhost with your nagios server address.

Optional

nagios.command_url

URL 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.timeout

timeout duration in msecs to get nagios histogram and trends images.

Optional

Nagios XI ticket

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.

Text

1 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.

Still need help?

The Atlassian Community is here for you.