• Products
  • Get started
  • Documentation
  • Resources

Integrate with Icinga 2

This article highlights a new alerting feature that's natively available in Jira Service Management which is gradually rolling out to some Jira Service Management Cloud customers. It may not yet be visible or available on your site.

Icinga 2 Logo

What does the integration offer?

The Icinga 2 integration plugin utilizes the full capabilities of Jira Service Management and provides bidirectional integration with Icinga 2.

How does the integration work?

  • Icinga 2 sends alerts to Jira Service Management with detailed information. Jira Service Management acts as a dispatcher for Icinga 2 alerts, determines the right people to notify based on on-call schedules– notifies via email, phone calls, text messages (SMS), and iPhone & Android push notifications, and escalates alerts until they are acknowledged or closed.

  • Jira Service Management automatically connects to Icinga 2, gets performance data from Graphite for the host/service, and attaches it to the alert.

  • Jira Service Management posts alert updates to Icinga 2. For example, acknowledging the alert will automatically ack the alert in Icinga 2, alert comments are reflected in Icinga 2, etc.

Set up the integration

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

Installation prerequisites

The installation packages support the following systems:

  • RedHat-based Linux distributions

  • Debian-based Linux distributions

Install the Jira Service Management plugin for Icinga 2

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

Instructions for RedHat-based distributions

Run the following command: 

rpm -i jsm-icinga2-<your_version>.rpm

The rpm package does not overwrite the existing configuration during upgrades. It saves the new default configuration file as integration.conf.rpmnew. Read more about config file handling for rpm upgrades.

If you're updating the integration from version 1, update your integration.conf file:

  • Remove the icinga.alert_histogram_image_url, icinga.trends_image_url, and icinga.command_url properties.

  • Add the icinga.api_url (Icinga 2 API endpoint of your Icinga server) and icinga.graphite_url properties.

Instructions for Debian-based distributions

Run the following command: 

dpkg -i jsm-icinga2-<your_version>.deb

Instructions for other distributions

Run the following command:

unzip jsm-icinga2-<your_version>.zip

Add an Icinga 2 integration

Bidirectional integrations aren’t supported in Free and Standard plans. All the other integrations are supported at a team level in Free and Standard; however, for their outgoing part to work, you need to upgrade to a higher plan. To add any integration at a site level through Settings (gear icon) > Products (under JIRA SETTINGS) > OPERATIONS, you need to be either on Premium or Enterprise.

Adding an integration from your team’s operations page makes your team the owner of the integration. This means Jira Service Management only assigns the alerts received through this integration to your team.

To add an Icinga 2 integration in Jira Service Management, complete the following steps:

  1. Go to your team’s operations page.

  2. On the left navigation panel, select Integrations and then Add integration.

  3. Run a search and select “Icinga 2”.

  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 integration URL.
    You will use this URL while configuring the integration in Icinga 2 later. The API key is used by Icinga 2 to authenticate with Jira Service Management and specify the integration to process Icinga 2 alerts.

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

Configure the Jira Service Management plugin in Icinga 2

The plugin uses a golang-executable file (included in the plugin as send2jsm) to create, acknowledge, and close alerts in Jira Service Management. Configure Icinga 2 to execute this file on events to create, acknowledge, and close alerts in Jira Service Management. Setting the apiKey is required. Other configuration parameters are set to defaults that work with most Icinga 2 implementations but may also need to be modified. The following table lists the parameters and states if they are mandatory:

Configuration parameters

Configuration parameter

Description

Mandatory?

Location

apiKey

Copy the URL from the integration configuration page in Jira Service Management. send2jsm uses this key to authenticate to Jira Service Management. API key is also used to identify the proper integration configuration that should be used to process alerts.

Yes

/home/jsm/jec/conf/jec-config.json

baseUrl

Change this field according to your Jira Service Management environment (For example: EU, sandbox)

No

/home/jsm/jec/conf/jec-config.json

responders

The default responder. This field is used to specify which responders should be notified for Icinga 2 alerts. You can modify it to route alerts to different teams or schedules in Jira Service Management. This field is required if you haven’t set responders in the integration configuration page.

No

/home/jsm/jec/conf/integration.conf

tags

Tags of the alert created in Jira Service Management.

No

/home/jsm/jec/conf/integration.conf

icinga_server

The Icinga 2 server in Jira Service Management. It is only required when there are multiple Icinga 2 servers. This is used by Jira Service Management when sending actions run by users (acknowledge, close, etc.) back to your Icinga 2 servers via JEC.

No

/home/jsm/jec/conf/integration.conf

logPath

The full path of the log file (Default:  /var/log/jec/send2jsm.log)

No

/home/jsm/jec/conf/integration.conf

icinga2jsm.http.proxy.enabled

To enable or disable the external proxy configuration. Default: false

No

/home/jsm/jec/conf/integration.conf

icinga2jsm.http.proxy.host

Host of the proxy

No

/home/jsm/jec/conf/integration.conf

icinga2jsm.http.proxy.port

Port of the proxy

No

/home/jsm/jec/conf/integration.conf

icinga2jsm.http.proxy.scheme

The proxy connection protocol. It may be http or https, depending on your proxy servers. Default: http

No

/home/jsm/jec/conf/integration.conf

icinga2jsm.http.proxy.username

The username for proxy authentication

No

/home/jsm/jec/conf/integration.conf

icinga2jsm.http.proxy.password

The password for proxy authentication

No

/home/jsm/jec/conf/integration.conf

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

Method 1: Configure from conf file

Configure from the /home/jsm/jec/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 definition in the /etc/icinga2/features-available/jsm.conf file. Use -apiKey flag for your apiKey and -is flag for the icinga_server name. If no multiple Icinga 2 servers are in use, you don't have to define the Icinga 2 server. Using flags overwrites all the other configuration methods mentioned earlier.

To send additional custom arguments, define them as key-value pairs in the argumentsdictionary. Since Icinga 2 shuffles the arguments, use the order property to ensure the custom arguments are placed at the end of the list. Example:

1 2 3 4 5 6 7 8 9 "-spd" = "$service.perfdata$" "customargument1" = { value = "$customargument1$" order = 1 }

Parse custom arguments by adding {{_payload.customArgName}} to the input fields as needed.
Read more about dynamic properties.

Method 3: Configure from script

Configure apiKey and icinga_server from send2jsm.go script. Build the script again and add the new executable to the /home/jsm/jec/scripts directory. Find information about the location of the send2jsm.go and how to build a go script in the Source section.

Configure the golang-executable to use a proxy for sending HTTP requests by defining the HTTP_PROXY=http://host:port environment variable.

Define Icinga contacts

1. Copy /home/jsm/jec/conf/jsm.conf as an available Icinga feature:

Shell

1 cp /home/jsm/jec/conf/jsm.conf /etc/icinga2/features-available/jsm.conf

2. Enable jsm and restart Icinga 2:

Shell

1 icinga2 feature enable jsm

3. Restart Icinga:

1 systemctl restart icinga2

If everything goes well, alerts are seen in Jira Service Management for every notification created in Icinga 2.

Optional: Configure Jira Service Management to update Icinga 2

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

To run actions in Icinga 2, JEC gets the configuration parameters from the configuration file config.json (found at /home/jsm/jec/conf/jec-config.json).

Configuration parameters

  • api_url: JEC uses this URL to post alert updates to Icinga 2, such as alert acknowledgment, comments, etc. Replace the "https://localhost:5665" with the API endpoint of your Icinga 2 server.

  • graphite_url (optional): JEC retrieves performance data graphs from Icinga 2 using this URL. Replace the "http://localhost:5003" with the Graphite endpoint of your Icinga 2 server.

  • user: The username to authenticate to Icinga 2 API

  • password: The password to authenticate to Icinga 2 API.

  • http.timeout: The timeout duration in milli secs to connect to Icinga 2 API.

  • expire_acknowledgement_after: Removes acknowledgment after the specified time (in minutes.) Disabled by default.

  • insecure: Ignore SSL verification while accessing the API endpoint of your Icinga 2 server.

The downloaded package includes the JEC utility (found in /usr/local/bin) and the script that JEC needs to run (found in /home/jsm/jec/scripts). Be sure to run JEC after configuring it. Find out how to run JEC.

The Icinga 2 integration package doesn’t support SSL v1.0. If your Icinga 2 server has SSL v1.0, upgrade your SSL server.

Source for and recompiling send2jsm

The source for the executable send2jsm is found in /usr/bin/ and send2jsm.go, in /home/jsm/jec/scripts, respectively. You can also download them from the repository. To change the behavior of the executable, edit send2jsm.go and build it by using the following command: go build send2jsm.go. Find out how to install go. 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.

1. Icinga alerts aren’t getting created in Jira Service Management

Run the following test command from the shell and check if a test alert is created in Jira Service Management: 

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

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

  • If the alert is not created in Jira Service Management, check the logs at /var/log/jec/send2jsm.log.
    Look for the following errors in the log file:

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

    • If a "Could not execute this action with apiKey of [Icinga2] integration" error is seen in the logs, the wrong integration package may have been downloaded. Make sure the downloaded Icinga 2 integration package is correct.

    • 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/jec/send2jsm.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/jec directory. The installation package should automatically do this for you. If you face issues, run the following command: 
      chown -R icinga:jsm /var/log/jec

    2. Check the Icinga 2 server logs at /var/log/icinga2/icinga2.log. See if there are error logs regarding send2jsm. Contact us with the logs as needed.

Set the send2jsm plugin's log level to DEBUG

Set the send2jsm plugin's log level to DEBUG. Open the /home/jsm/jec/conf/integration.conf file and change the line send2jsm.logger=warning to icinga2jsm.logger=debug.

2. The Icinga 2 alert isn’t acknowledged when the alert is acknowledged in Jira Service Management

Check the alert logs.

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

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

3. Couldn’t open Icinga RPM package

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

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

4. Error in perf_data.png generation in icinga 2

If you're receiving an error while embedding perfData graphite into HTML, your Icinga 2 version is using perfData.png instead of perf_data.png for the graphite name. To fix the issue, update the python script as follows:

1 2 3 4 From: buf += """<div class="img"><img src="perf_data.png"></div>""" To: buf += """<div class="img"><img src="perfData.png"></div>"""

 

Still need help?

The Atlassian Community is here for you.