Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
curl -X POST -H 'Authorization: Bearer xoxb-AAAAAAAAAAAAA-BBBBBBBBBBBBB-CCCCCCCCCCCCCCCCCCCCCCCC' -H 'Content-type: application/json' \
--data '{"channel":"C01QZLFBK71","text":"This is a sample message from JETI."}' https://slack.com/api/chat.postMessage

Preparations to use OpsGenie for alerting

First of all, you need to have a Cloud instance, where the OpsGenie app is activated.

To achieve this on an already existing Atlassian site, you can create a Jira Service Management project, then create a team and add OpsGenie integration. For example, if your site URL is https://{your-atlassian-site}.atlassian.net, then the OpsGenie app will be accessible via the following link: https://{your-atlassian-.site}.app.opsgenie.com/alert/list

The alternative option is to register a new OpsGenie account in an independent way (not starting from a Jira project). In this case, a new Atlassian Cloud site will be automatically set up for you (of course, without Jira integration in place).
At this stage, we have some complications. If you opted for data storage in the EU, then the URL of your OpsGenie will contain an extra “.eu” segment, like https://{your-atlassian-.site}.app.eu.opsgenie.com/alert/list

Note

The geological location of your instance will also impact the URL of the OpsGenie API (see later):
In the EU: https://api.eu.opsgenie.com
Everywhere else: https://api.opsgenie.com

Please keep in mind that the Service URL in the auto-generated template has to be adjusted accordingly.

Basic configuration [required]

The first step is to make Email This Issue for Jira able to authenticate with OpsGenie. To achieve this, you have to acquire an API key. This can be done in two ways:

By using the default integration configuration:
In Settings / Configured Integrations select the Default API entry:

...

Create a new integration configuration:
In Settings / Integration List select the API option:

...

Note

For Free and Essentials plans, the integrations can only be added from the Team Dashboards, as seen in the image below.

...

API Integration documentation: https://docs.opsgenie.com/docs/api-integration

Warning

There is a possibility of misconfiguration: when adding a new API key via the Settings / API key management option, the generated key could not be used for creating alerts. As a consequence, it is highly recommended to start the integration process from the Teams tab.

...

Creating alerts with custom content [supplementary]

Although Email This Issue for Jira provides you with a general-purpose template to create alerts in OpsGenie, you may want to further customize the posted request. Some information can be found here on this topic.

Headers:

  • Content-type: application/json (automatically added)

  • Authorization: GenieKey <api key>

Message payload (JSON body):

The request body may be enriched with the following fields that will be parsed by OpsGenie, while creating the alert based on the incoming request:

...

Field

...

Mandatory

...

Description

...

Limit

...

message

...

Status
colourRed
titlemandatory

...

Message of the alert

...

130 characters

...

alias

...

Status
colourGreen
titleOptional

...

This field is used for alert de-duplication. When there is an open alert with the same alias, no new alert is created, only a counter will be incremented. After closing this alert, and there is a new alert with the same alias sent in, a new alert will be created.

...

512 characters

...

description

...

Status
colourGreen
titleOptional

...

Description field of the alert that is generally used to provide detailed information about the alert.

...

15 000 characters

...

tags

...

Status
colourGreen
titleOptional

...

Tags of the alert.

...

20 x 50 characters

...

details

...

Status
colourGreen
titleOptional

...

Map of key-value pairs to use as custom properties of the alert.

...

8 000 characters total

...

entity

...

Status
colourGreen
titleOptional

...

Entity field of the alert that is generally used to specify, to which domain the alert is related.

...

512 characters

...

priority

...

Status
colourGreen
titleOptional

...

Priority level of the alert. Possible values are P1P2P3P4 and P5. Default value is P3.

For more details, please read the Alert API documentation: https://docs.opsgenie.com/docs/alert-api