Opsgenie's Nagios plugin is the recommended integration method as it enables Nagios to take advantage of advanced capabilities provided by Opsgenie.
The steps below describe how to integrate Opsgenie and Nagios using Opsgenie's Nagios integration plugin. Note that you may need to slightly alter these instructions depending on your exact Linux distribution and your Nagios configuration.
This document contains only specific instructions for deprecated Nagios integration. For other steps please refer to the new Nagios Integration's document.
Packages are provided for Red Hat and Debian based Linux distributions.
Opsgenie Nagios Plugin is a java application, therefore, requires the Java Runtime version 1.6+ Both the Open JDK and Oracle JVMs can be used.
Ensure that JAVA_HOME environment variable is set. If it is not, you may set it by removing the comment at the beginning 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>
To add Nagios integration in Opsgenie, go to Opsgenie Nagios 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 to authenticate with Opsgenie and specify the integration that should be used to process Nagios alerts.
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 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. Setting the apiKey parameter is required. Other configuration parameters are set to defaults that work with most Nagios implementations but may need to be modified as well.
Mandatory to fill
Copy the API key from the Nagios 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.
nagiosServer field is used to identify the Nagios server in Opsgenie, and only required when there are multiple Nagios servers. This field is used by Opsgenie when sending actions executed by users (acknowledge, close, etc.) back to your Nagios servers via Marid
If enabled, lamp can attached histogram and trend images to alerts in Opsgenie. The default is enable.
Lamp retrieves histogram images from Nagios using this URL. Localhost should be replaced with your nagios server address.
Lamp retrieves trends images from Nagios using this URL. Localhost should be replaced with your nagios server address.
URL to update Nagios alerts when alerts get acknowledged, commented, etc.
Username to authenticate Nagios web server to get nagios histogram and trends images.
Password to authenticate Nagios web server to get nagios histogram and trends images.
Timeout duration in msecs to get Nagios histogram and trends images.
If the integration works as expected, when a host or service state becomes down in Nagios, 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 is able to create alerts in Opsgenie
Check whether there are alert from Nagios in Opsgenie. If Nagios 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 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 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
Updated about 3 years ago