• Get started
  • Documentation

Integrate Opsgenie with Icinga

Overview

Icinga integration diagram

What does the integration offer?

Opsgenie’s Icinga plugin supports a bidirectional integration with Icinga. The integration leverages Opsgenie’s Icinga-specific executable and OEC utility to automatically create rich alerts (status, alert histogram, trends, etc.) and synchronizes alert status between Icinga and Opsgenie.

Set up the integration

The Icinga integration plugin utilizes the full capabilities of Opsgenie and provides bi-directional integration with Icinga. The steps in the following procedure describe how to integrate Opsgenie and Icinga by using the Icinga integration plugin. Note that slight alteration to these instructions may be necessary depending on the exact Linux distribution and your Icinga configuration.

Installation prerequisites

The installation packages support the following systems:

  • RedHat-based Linux distributions

  • Debian-based Linux distributions

Install the Opsgenieplugin for Icinga

Opsgenie Edge Connector (abbreviated as OEC) is a prerequisite for configuring the outgoing authentication of Icinga integration. You can combinedly use OEC and Icinga scripts to update alerts on Icinga. With this setup, you can deploy your own script, modify the ones provided, or run customized actions on Icinga. Download the latest version of the Icinga package from this repository.

RedHat-based Linux distributions

rpm -i opsgenie-icinga-<your_version>.rpm

Before rpm upgrades, back up your configuration files.

The rpm package does not overwrite the existing configuration during upgrades. It saves the new default configuration file as integration.conf.rpmnew. To upgrade from version 201X-XX-XX to 2.X.X, add the --force parameter. For example: rpm -U --force opsgenie-icinga-<your_version>.rpm

Learn more about config file handling for rpm upgrades.

Debian-based Linux distributions

Run the following command: 

dpkg -i opsgenie-icinga-<your_version>.deb

Add an Icinga integration

If you're using Opsgenie's Free or Essentials plan or if you’re using Opsgenie with Jira Service Management's Standard plan, you can add this integration from your team dashboard only. The Integrations page under Settings is not available in your plan.

  1. Go to Teams and select your team.

  2. Select Integrations on the left navigation and then select Add integration.

Adding the integration from your team dashboard will make your team the owner of the integration. This means Opsgenie will assign the alerts received through this integration to your team only. Follow the rest of the steps in this section to set up the integration.

To add an Icinga integration in Opsgenie:

  1. Go to Settings > Integrations.

  2. Select Add integration.

  3. Run a search and select “Icinga”.

  4. On the next screen, enter a name for the integration.

  5. Optional: Select a team in Assignee team if you want a specific team to receive alerts from the integration.

  6. Select Continue.
    The integration is saved at this point.

  7. Expand the Steps to configure the integration section and copy the API key.
    You will use this key while configuring the integration in Icinga later. Icinga uses the key to authenticate with Opsgenieand specify the integration to be used to process Icinga alerts.

  8. Select Turn on integration.
    The rules you create for the integration will work only if you turn on the integration.

Configure the Opsgenie plugin in Icinga

The plugin uses a golang-executable file (included in the plugin as send2opsgenie) to create, acknowledge, and close alerts in Opsgenie. Configure Icinga to execute this file on events to create, acknowledge, and close alerts in Opsgenie. The following table lists the parameters and states if they are mandatory.

Configuration Parameter

Description

Mandatory to fill

Location

apiKey

Copy the API key from the Icinga integration you've created above. send2opsgenie uses this key to authenticate to Opsgenie. API key is also used to identify the right integration configuration that should be used to process alerts.

Yes

/home/opsgenie/oec/conf/config.json

baseUrl

If you're using Opsgenie from another domain(eg. EU, sandbox), you should update this configuration.Opsgenie Icinga integration, Advanced Settings page.

Optional

/home/opsgenie/oec/conf/config.json

responders

Responders field is used to specify which teams should be notified for the Icinga alerts. This field is used to set the default teams field value. It can be modified to route different alerts to different teams in Opsgenie Icinga integration, Advanced Settings page.

Optional

/home/opsgenie/oec/conf/opsgenie-integration.conf

tags

Tags field is used to specify the tags of the alert that created in Opsgenie.

Optional

/home/opsgenie/oec/conf/opsgenie-integration.conf

icinga_server

icinga_server field is used to identify the Icinga server in Opsgenie, and only required when there are multiple Icinga servers. This field is used by Opsgenie when sending actions executed by users (acknowledge, close, etc.) back to your Icinga servers via OEC

Optional

/home/opsgenie/oec/conf/opsgenie-integration.conf

logPath

Specifies the full path of the log file. (Default value is /var/log/opsgenie/isend2opsgenie.log)

Optional

/home/opsgenie/oec/conf/opsgenie-integration.conf

icinga2opsgenie.http.proxy.enabled

icinga2opsgenie.http.proxy.enabled field is to enable/disable external proxy configuration. The default value is false.

Optional

/home/opsgenie/oec/conf/opsgenie-integration.conf

icinga2opsgenie.http.proxy.host

It is the host of the proxy.

Optional

/home/opsgenie/oec/conf/opsgenie-integration.conf

icinga2opsgenie.http.proxy.port

It is the port of the proxy.

Optional

/home/opsgenie/oec/conf/opsgenie-integration.conf

icinga2opsgenie.http.proxy.scheme

It is the proxy connection protocol. It may be http or https depending on your proxy servers. Its default value is http.

Optional

/home/opsgenie/oec/conf/opsgenie-integration.conf

icinga2opsgenie.http.proxy.username

It is the Proxy authentication username.

Optional

/home/opsgenie/oec/conf/opsgenie-integration.conf

icinga2opsgenie.http.proxy.password

It is the Proxy authentication password.

Optional

/home/opsgenie/oec/conf/opsgenie-integration.conf

Configure the golang-executable file in any of the following three methods:

Method 1: Configure from conf file

Configure from the /home/opsgenie/oec/conf/integration.conf file. This overwrites any configuration you previously made in the script.

Method 2: Configure by using Golang flags

Configure by entering flags into the command of the notification created in Icinga, as described earlier in this section. Use -apiKey flag for your apiKey.

To send additional custom arguments, add them after the flags. For example, customArgName1 customArgValue1 customArgName2 customArgValue2. Parse custom arguments by adding {{_payload.customArgName}} to wherever is needed in the input fields. Learn more about using raw parameters.

Method 3: Configure from script

Configure apiKey from the send2opsgenie.go script. Build the script again and put the new executable into the /home/opsgenie/oec/scripts directory. Learn more about the location of the send2opsgenie.go and how to build a go script in the “Source and recompiling send2opsgenie” section in this article.

Define Icinga contacts

1. Copy the /home/opsgenie/oec/opsgenie-icinga/opsgenie.cfg file (configures a contact, its host, and service notification commands) in to /usr/local/icinga/etc/objects directory.

Shell

1 cp /home/opsgenie/oec/opsgenie-icinga/opsgenie.cfg /usr/local/icinga/etc/objects

2. Add the following line to the main Icinga configuration file (ICINGA_HOME/etc/icinga.cfg):

Shell

1 2 3 ... cfg_file=/usr/local/icinga/etc/objects/opsgenie.cfg ...

Add the contact “opsgenie" to the Icinga configuration’s main contact group in ICINGA_HOME/etc/objects/contacts.cfg file. If using the default configuration contacts.cfg, add "opsgenie" user to the "admins" contact group.

4. Restart Icinga.

If everything goes well, alerts are seen in Opsgenie for every notification created in Icinga.

Icinga notification
Icinga attachment

Configure Opsgenie to update Icinga

This is an optional step.

Select the Send Alert Actions To Icinga checkbox on the integration configuration page. You can combinedly use OEC and Icinga scripts to update alerts on Icinga. With this setup, you can deploy your own script, modify the ones provided, or run customized actions on Icinga.

To run actions in Icinga, OEC gets the configuration parameters from the configuration file, config.json (found at /home/opsgenie/oec/conf/oec-config.json).

Configuration parameters

  • alert_histogram_image_url: OEC retrieves histogram images from Icinga using this URL. Localhost should be replaced with the Icinga server address.

  • trends_image_url: OEC retrieves trends images from Icinga using this URL. Localhost should be replaced with the Icinga server address.

  • command_url: URL to update Icinga alerts when alerts get acknowledged, commented, etc.

  • user: Username to authenticate Icinga web server to get Icinga histogram and trends images.

  • password: Password to authenticate Icinga web server to get Icinga histogram and trends images.

The downloaded package includes the OEC utility (found in /usr/local/bin) and the script that OEC needs to run (found in /home/opsgenie/oec/scripts). Be sure to run OEC after configuring it. Learn more about running OEC.

The Icinga integration package does not support SSL v1.0. If your Icinga Server has SSL v1.0, upgrade your SSL server.

Source and recompiling send2opsgenie

The source for the executable send2opsgenie is found in /usr/bin/ and send2opsgenie.go, in /home/opsgenie/oec/scripts respectively and is also available in this repository. To change the behavior of the executable, edit send2opsgenie.go and build it by using the following command: go build send2opsgenie.go

For installing go, refer to http://golang.org/doc/install. Note that the executable in the plugin is built for linux/386 systems.

FAQ and troubleshooting

If the integration is not working, review this section and follow the prescribed guidelines.

Icinga alerts are not getting created in Opsgenie

Run the following test command from the shell and check if a test alert is created in Opsgenie

1 /home/opsgenie/oec/scripts/send2opsgenie -entityType=host -t=PROBLEM -hs=DOWN -hn=test_host
  • If you get a "Trace/breakpoint trap" error, the send2opsgenie plugin isn't compatible with the server distribution. Rebuild send2opsgenie.go according to the specific server environment as described in the “Source and recompiling send2opsgenie” section in this article.

  • If the alert is created in Opsgenie, the integration is configured correctly. Icinga is probably not notifying the Opsgenie contact for alerts. Check your Icinga alert notifications log.

  • If the alert is not created in Opsgenie check the logs at /var/log/oec/send2opsgenie.log.
    Look for the following errors in the log file:

    • If you see "RestException[Could not authenticate.]" in the logs, Opsgenie couldn't identify the API key. Check if the API key is set correctly per the steps outlined in the “Configure the Opsgenie plugin in Icinga” section of this article.

    • If unsure of the problem, set the plugin's log level to debug and try again. Contact us and share the logs.

  • If there is no /var/log/oec/send2opsgenie.log file or there are no logs in it, check the following:

    1. Check if the Icinga user has permission to write to /var/log/oec directory. The installation package should automatically do this for you. If you face issues, run the following command: 
      chown -R icinga:opsgenie /var/log/oec

    2. Check the Icinga server logs at /opt/icinga/log/zeneventd.log. See if there are error logs regarding send2opsgenie. Contact us with the logs as needed.

Set send2opsgenie plugin's log level to DEBUG

Set the send2opsgenie plugin's log level to DEBUG. Open the /home/opsgenie/oec/conf/integration.conf file and change the line send2opsgenie.logger=warning to icinga2opsgenie.logger=debug.

The Icinga alert is not acknowledged when the alert is acknowledged in Opsgenie

Check the activity log.

  • If "Posted [Acknowledge] action to Icinga.." is not present in the log, Opsgenie didn't send the Acknowledge action to Icinga. Check the integration configuration, it might not have a matching the alert action.

  • If only the "Posted [Acknowledge] action to Icinga.." log occurs followed by no related logs, it might mean OEC is having connection problems. Check the logs.

Learn more about activity logs.

Could not open Icinga RPM package

  • If you figure out while installing the rpm package that the package is obsolete, use rpm -i opsgenie-icinga-1.0.4-rpm-x86-64.rpm --nodeps instead.

  • If you get "is already installed" error, use rpm -i opsgenie-icinga-1.0.4-rpm-x86-64.rpm --force instead.

Still need help?

The Atlassian Community is here for you.