• Products
  • Get started
  • Documentation
  • Resources

Integrate with Nagios XI

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.

Nagios logo

Jira Service Management provides a two-way rich integration plugin for Nagios XI. Besides that, Jira Service Management provides a number of easy-to-use integration methods (email, API, command line tools, programming libraries, etc.) to ensure all monitoring tools can be easily integrated with Jira Service Management. Nagios XI can be integrated with Jira Service Management via the email interface, or by executing scripts in any language that uses Jira Service Management Web API. This document describes two supported integration options.

This article explains integrating Jira Service Management with Nagios XI. Find out how to use Nagios.

What does the integration offer?

Jira Service Management Nagios XI plugin supports bi-directional integration with Nagios XI. Integration leverages Jira Service Management’s Nagios-specific executable and JEC utility to automatically create rich alerts (status, alert histogram, trends, etc.) and synchronizes alert status between Nagios XI and Jira Service Management. Jira Service Management Nagios XI plugin is the recommended integration method as it enables Nagios XI to take advantage of advanced capabilities provided by Jira Service Management.

How does the integration work?

  • When a host or service state becomes down in Nagios XI, an alert is created in Jira Service Management.

  • Upon creating the new alert, related histogram and trends images from Nagios XI are automatically attached to the alert.

  • When the Jira Service Management alert is acknowledged, the alert in Nagios XI is also acknowledged automatically, and vice versa.

  • When a note is added to the Jira Service Management alert, the alert in Nagios XI is also updated automatically, and vice versa.

Set up the integration

The Nagios XI integration plugin utilizes the full capabilities of Jira Service Management and provides bi-directional integration with Nagios XI. The steps in the following procedure describe how to integrate Jira Service Management and Nagios XI using the Nagios XI integration plugin. Note that slight alteration to these instructions may be necessary depending on the exact Linux distribution and your Nagios XI 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 Nagios XI

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

Instructions for RedHat-based distributions

Run the following command: 

rpm -i jsm-nagiosxi-<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. Add the-- force parameter to upgrade from version 201X-XX-XX to 2.X.X. For example: rpm -U --force jsm-nagiosxi-<your_version>.rpm. Read more about config file handling for rpm upgrades.

Instructions for Debian-based distributions

Run the following command: 

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

Add a Nagios XI integration

If you're using the Free or Standard plan in Jira Service Management, you can only add this integration from your team’s operations page. To access the feature through Settings (gear icon) > Products (under JIRA SETTINGS) > OPERATIONS, you need to be on Premium or Enterprise plan.

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 a Nagios XI 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 “Nagios XI”.

  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 Nagios XI later.

  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 Nagios XI

The plugin uses a golang-executable file (included in the plugin as send2jsm) to create, acknowledge, and close alerts in Jira Service Management. To make send2jsm work, you need to make some configurations. The following table lists the parameters and states if they are mandatory. Setting the apiKey is required. Other configuration parameters are set to their default values that work with most Nagios XI implementations but may also need to be modified.

Configuration parameters

Configuration parameters

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 right 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

teams

Teams that should be notified of the Nagios XI alerts. Use the field to set the default value. You can modify it to route alerts to different teams on the integration configuration page in Jira Service Management.

No

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

tags

Tags of the alert that were created in Jira Service Management.

No

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

nagios_server

The Nagios XI server in Jira Service Management is only required when multiple Nagios XI servers exist. This is used by Jira Service Management when sending actions run by users (acknowledge, close, etc.) back to your Nagios XI servers via JEC.

No

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

logPath

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

No

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

nagios2jsm.http.proxy.enabled

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

No

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

nagios2jsm.http.proxy.host

Host of the proxy

No

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

nagios2jsm.http.proxy.port

Port of the proxy

No

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

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

nagios2jsm.http.proxy.username

The username for proxy authentication

No

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

nagios2jsm.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 from the Nagios XI web interface through Configure > Core Config Manager > Commands. Use -apiKey flag for your apiKey and -ns flag for your nagios_server name. If you don't have multiple Nagios servers, you don't have to define the Nagios server. Using flags overwrites all the other configuration methods mentioned earlier.

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. Read more about dynamic properties.

Method 3: Configure from script

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

Define Nagios XI commands

1. Create and configure host and service notification commands with the following content from Nagios XI web interface through Configure > Core Config Manager > Commands.

2. Define the host command:
Command name: notify-host-by-jsm
Command type: misc command
Command line:

1 /home/jsm/jec/scripts/send2jsm -entityType=host -t="$NOTIFICATIONTYPE$" -ldt="$LONGDATETIME$" -hn="$HOSTNAME$" -hdn="$HOSTDISPLAYNAME$" -hal="$HOSTALIAS$" -haddr="$HOSTADDRESS$" -hs="$HOSTSTATE$" -hsi="$HOSTSTATEID$" -lhs="$LASTHOSTSTATE$" -lhsi="$LASTHOSTSTATEID$" -hst="$HOSTSTATETYPE$" -ha="$HOSTATTEMPT$" -mha="$MAXHOSTATTEMPTS$" -hei="$HOSTEVENTID$" -lhei="$LASTHOSTEVENTID$" -hpi="$HOSTPROBLEMID$" -lhpi="$LASTHOSTPROBLEMID$" -hl="$HOSTLATENCY$" -het="$HOSTEXECUTIONTIME$" -hd="$HOSTDURATION$" -hds="$HOSTDURATIONSEC$" -hdt="$HOSTDOWNTIME$" -hpc="$HOSTPERCENTCHANGE$" -hgn="$HOSTGROUPNAME$" -hgns="$HOSTGROUPNAMES$" -lhc="$LASTHOSTCHECK$" -lhsc="$LASTHOSTSTATECHANGE$" -lhu="$LASTHOSTUP$" -lhd="$LASTHOSTDOWN$" -lhur="$LASTHOSTUNREACHABLE$" -ho="$HOSTOUTPUT$" -lho="$LONGHOSTOUTPUT$" -hnu="$HOSTNOTESURL$" -hpd="$HOSTPERFDATA$"

3. Define the service command.
Command name: notify-service-by-jsm
Command type: misc command
Command line:

1 /home/jsm/jec/scripts/send2jsm -entityType=service -t="$NOTIFICATIONTYPE$" -ldt="$LONGDATETIME$" -hn="$HOSTNAME$" -hdn="$HOSTDISPLAYNAME$" -hal="$HOSTALIAS$" -haddr="$HOSTADDRESS$" -hs="$HOSTSTATE$" -hsi="$HOSTSTATEID$" -lhs="$LASTHOSTSTATE$" -lhsi="$LASTHOSTSTATEID$" -hst="$HOSTSTATETYPE$" -ha="$HOSTATTEMPT$" -mha="$MAXHOSTATTEMPTS$" -hei="$HOSTEVENTID$" -lhei="$LASTHOSTEVENTID$" -hpi="$HOSTPROBLEMID$" -lhpi="$LASTHOSTPROBLEMID$" -hl="$HOSTLATENCY$" -het="$HOSTEXECUTIONTIME$" -hd="$HOSTDURATION$" -hds="$HOSTDURATIONSEC$" -hdt="$HOSTDOWNTIME$" -hpc="$HOSTPERCENTCHANGE$" -hgn="$HOSTGROUPNAME$" -hgns="$HOSTGROUPNAMES$" -lhc="$LASTHOSTCHECK$" -lhsc="$LASTHOSTSTATECHANGE$" -lhu="$LASTHOSTUP$" -lhd="$LASTHOSTDOWN$" -lhur="$LASTHOSTUNREACHABLE$" -ho="$HOSTOUTPUT$" -lho="$LONGHOSTOUTPUT$" -hpd="$HOSTPERFDATA$" -s="$SERVICEDESC$" -sdn="$SERVICEDISPLAYNAME$" -ss="$SERVICESTATE$" -ssi="$SERVICESTATEID$" -lss="$LASTSERVICESTATE$" -lssi="$LASTSERVICESTATEID$" -sst="$SERVICESTATETYPE$" -sa="$SERVICEATTEMPT$" -msa="$MAXSERVICEATTEMPTS$" -siv="$SERVICEISVOLATILE$" -sei="$SERVICEEVENTID$" -lsei="$LASTSERVICEEVENTID$" -spi="$SERVICEPROBLEMID$" -lspi="$LASTSERVICEPROBLEMID$" -sl="$SERVICELATENCY$" -set="$SERVICEEXECUTIONTIME$" -sd="$SERVICEDURATION$" -sds="$SERVICEDURATIONSEC$" -sdt="$SERVICEDOWNTIME$" -spc="$SERVICEPERCENTCHANGE$" -sgn="$SERVICEGROUPNAME$" -sgns="$SERVICEGROUPNAMES$" -lsch="$LASTSERVICECHECK$" -lssc="$LASTSERVICESTATECHANGE$" -lsok="$LASTSERVICEOK$" -lsw="$LASTSERVICEWARNING$" -lsu="$LASTSERVICEUNKNOWN$" -lsc="$LASTSERVICECRITICAL$" -so="$SERVICEOUTPUT$" -lso="$LONGSERVICEOUTPUT$" -snu="$SERVICENOTESURL$" -spd="$SERVICEPERFDATA$"

4. Select Apply New Configuration for the changes to take effect.

Define Nagios XI Contacts

1. Go to Configure > Core Config Manager > Contacts.

2. Select Add New.

3. Populate the Common Settings as follows:
Contact Name: jsm
Description: JSM Contact

4. Select the Active checkbox.

5. Populate alert settings:

Alert settings

Host Notifications Enabled

Selected

Host Notification Timeperiod

24×7

Host Notification options

down, unreachable (depending on the use case, you can select other options as well)

Manage Host Notification Commands

Add notify-host-by-jsm command to the list of selections

Service Notifications Enabled

Selected

Service Notification Timeperiod

24×7

Service Notification options

critical (depending on the use case, you can select other options as well)

Manage Service Notification Commands

Add notify-service-by-jsm command to the list of selections

6. Select Save and Apply Configuration.

Ensure that the contact is added to your Hosts and Services contact list. If everything goes well, you will see alerts in Jira Service Management for every notification created in Nagios XI. When the host or service comes back up, the alert in Jira Service Management gets closed automatically as well.

If you face any problems, check the send2jsm logs and the FAQ and troubleshooting section. Contact us with the logs if needed.

Configure Jira Service Management to update Nagios XI

This is an optional step.

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

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

Configuration parameters

  • alert_histogram_image_url: JEC retrieves histogram images from Nagios XI using this URL. Localhost should be replaced with the Nagios server address.

  • trends_image_url: JEC retrieves trends images from Nagios XI using this URL. Localhost should be replaced with the Nagios server address.

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

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

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

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. If using JEC, rich alerts are populated with host or service current status information in Jira Service Management for every notification created in Nagios XI.

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

Source and recompiling send2jsm

The source for the executable send2jsm is found in /usr/bin/ and send2jsm.go, in /home/jsm/jec/scripts respectively. They can also be downloaded 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 isn’t working, review this section and follow the prescribed guidelines.

1. Nagios 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 and recompiling send2jsm” section in this article.

  • If the alert is created in Jira Service Management, the integration is configured correctly. Nagios XI is probably not notifying the Jira Service Management contact for alerts. Check your Nagios XI 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 Nagios XI” 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/jec/send2jsm.log file or there are no logs in it, check the following:

    1. Check if the Nagios 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 nagios:jsm /var/log/jec

    2. Check the Nagios server logs at /opt/nagios/log/zeneventd.log. See if there are error logs regarding send2jsm. Contact us with the logs if needed.

Set 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 nagios2jsm.logger=debug.

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

Check the alert logs.

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

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

3. Couldn’t open Nagios RPM package

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

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

4. Permission error occurs while attaching zip file to alert in script

If you get "PermissionError: [Errno 13] Permission denied: details_*" error while running the script, prefix the path of the script to the "file_name" variable in the attach method of the script.

Additional Help