Grafana Integration

Grafana  is an open source metric analytics & visualization suite. It is most commonly used for visualizing time series data for Internet infrastructure and application analytics but many use it in other domains including industrial sensors, home automation, weather, and process control. OpsGenie is an alert and notification management solution that is highly complementary to Grafana's alerting mechanism.

What does OpsGenie offer to Grafana users?

By using OpsGenie’s Grafana Integration: you can forward Grafana alerts to OpsGenie. OpsGenie can determine the right people to notify based on on-call schedules, using email, text messages (SMS), phone calls, iOS & Android push notifications, and escalating alerts until the alert is acknowledged or closed.

Functionality of the integration

  • When an alert is created in Grafana, it creates an alert in OpsGenie.

Add Grafana Integration in OpsGenie

  1. Please create an OpsGenie account if you haven't done so already.
  2. Go to OpsGenie's Grafana Integration page.
  3. Specify who should be notified for Grafana alerts using the "Teams" and "Recipients" fields. Autocomplete suggestions will be provided as you type.
  4. Copy the Webhook URL.
  5. Click on "Save Integration."

Configuration in Grafana

  1. In Grafana, click on the top left Grafana icon.
  2. On Alerting tab choose Notifications.
  3. In Alert notifications page click + New Notification.
  4. Enter the Name of your notification.
  5. Choose webhook as Type.
  6. Paste the integration API URL into URL.
  7. Click Save.

Sample payload sent from Grafana

Create Alert payload:

{
  "title": "My alert",
  "ruleId": 1,
  "ruleName": "Load peaking!",
  "ruleUrl": "http://url.to.grafana/db/dashboard/my_dashboard?panelId=2",
  "state": "Alerting",
  "imageUrl": "http://s3.image.url",
  "message": "Load is peaking. Make sure the traffic is real and spin up more webfronts",
  "evalMatches": [
    {
      "metric": "requests",
      "tags": {},
      "value": 122
    }
  ]
}
                            

This payload is parsed by OpsGenie as:

{
  "alertName": "Load peaking!",
  "ruleUrl": "http://url.to.grafana/db/dashboard/my_dashboard?panelId=2",
  "alertState": "Alerting",
  "alertTitle": "My alert",
  "imageUrl": "http://s3.image.url",
  "message": "Load is peaking. Make sure the traffic is real and spin up more webfronts",
  "evalMatches": "metric : requests" + "\n" +
                 "tags {}" + "\n\t" +
                 "value : " + 122 + "\n\n"
}
                            

Sample alert