2016-11-07 08:18:14 -06:00
+++
title = "Alerting Notifications"
description = "Alerting Notifications Guide"
2016-11-08 00:04:46 -06:00
keywords = ["Grafana", "alerting", "guide", "notifications"]
2016-11-07 08:18:14 -06:00
type = "docs"
[menu.docs]
name = "Notifications"
parent = "alerting"
weight = 2
+++
2016-11-08 00:04:46 -06:00
# Alert Notifications
> Alerting is only available in Grafana v4.0 and above.
2018-01-14 02:09:49 -06:00
When an alert changes state, it sends out notifications. Each alert rule can have
multiple notifications. In order to add a notification to an alert rule you first need
2018-08-22 11:06:51 -05:00
to add and configure a `notification` channel (can be email, PagerDuty or other integration).
This is done from the Notification Channels page.
2017-05-03 15:27:10 -05:00
## Notification Channel Setup
2016-11-08 00:04:46 -06:00
2017-07-31 05:12:28 -05:00
On the Notification Channels page hit the `New Channel` button to go the page where you
2017-05-03 15:27:10 -05:00
can configure and setup a new Notification Channel.
2016-11-08 00:04:46 -06:00
2018-01-14 02:09:49 -06:00
You specify a name and a type, and type specific options. You can also test the notification to make
sure it's setup correctly.
2016-11-08 00:04:46 -06:00
2019-04-15 01:14:22 -05:00
### Default (send on all alerts)
2016-11-08 00:04:46 -06:00
2018-08-22 11:06:51 -05:00
When checked, this option will notify for all alert rules - existing and new.
### Send reminders
> Only available in Grafana v5.3 and above.
{{< docs-imagebox max-width = "600px" img = "/img/docs/v53/alerting_notification_reminders.png" class = "docs-image--right" caption = "Alerting notification reminders setup" > }}
When this option is checked additional notifications (reminders) will be sent for triggered alerts. You can specify how often reminders
should be sent using number of seconds (s), minutes (m) or hours (h), for example `30s` , `3m` , `5m` or `1h` etc.
2019-12-05 10:12:00 -06:00
**Important:** Alert reminders are sent after rules are evaluated. Therefore a reminder can never be sent more frequently than a configured [alert rule evaluation interval ]({{< relref "rules/#name-evaluation-interval" >}} ).
2018-08-22 11:06:51 -05:00
2018-08-23 11:56:37 -05:00
These examples show how often and when reminders are sent for a triggered alert.
2018-08-22 11:06:51 -05:00
2018-08-23 11:56:37 -05:00
Alert rule evaluation interval | Send reminders every | Reminder sent every (after last alert notification)
2018-08-22 11:06:51 -05:00
---------- | ----------- | -----------
`30s` | `15s` | ~30 seconds
`1m` | `5m` | ~5 minutes
`5m` | `15m` | ~15 minutes
`6m` | `20m` | ~24 minutes
`1h` | `15m` | ~1 hour
`1h` | `2h` | ~2 hours
< div class = "clearfix" > < / div >
2016-11-08 00:04:46 -06:00
2018-11-22 10:27:29 -06:00
### Disable resolve message
When checked, this option will disable resolve message [OK] that is sent when alerting state returns to false.
2017-05-03 15:27:10 -05:00
## Supported Notification Types
2016-11-08 00:04:46 -06:00
2017-05-03 15:27:10 -05:00
Grafana ships with the following set of notification types:
2016-11-08 00:04:46 -06:00
### Email
2019-12-05 10:12:00 -06:00
To enable email notifications you have to setup [SMTP settings ]({{< relref "../installation/configuration/#smtp" >}} )
2018-01-14 02:09:49 -06:00
in the Grafana config. Email notifications will upload an image of the alert graph to an
external image destination if available or fallback to attaching the image to the email.
2018-03-27 14:21:18 -05:00
Be aware that if you use the `local` image storage email servers and clients might not be
able to access the image.
2016-11-08 00:04:46 -06:00
2016-11-08 08:06:07 -06:00
### Slack
{{< imgbox max-width = "40%" img = "/img/docs/v4/slack_notification.png" caption = "Alerting Slack Notification" > }}
2018-01-14 02:09:49 -06:00
To set up slack you need to configure an incoming webhook url at slack. You can follow their guide on how
to do that [here ](https://api.slack.com/incoming-webhooks ). If you want to include screenshots of the firing alerts
in the Slack messages you have to configure either the [external image destination ](#external-image-store ) in Grafana,
2017-09-30 18:26:19 -05:00
or a bot integration via Slack Apps. Follow Slack's guide to set up a bot integration and use the token provided
2018-01-14 02:09:49 -06:00
(https://api.slack.com/bot-users), which starts with "xoxb".
2016-11-08 08:06:07 -06:00
Setting | Description
---------- | -----------
2019-03-08 10:00:40 -06:00
Url | Slack incoming webhook url.
Username | Set the username for the bot's message.
Recipient | Allows you to override the Slack recipient.
Icon emoji | Provide an emoji to use as the icon for the bot's message. Ex :smile:
Icon URL | Provide a url to an image to use as the icon for the bot's message.
2018-01-14 02:09:49 -06:00
Mention | make it possible to include a mention in the Slack notification sent by Grafana. Ex @here or @channel
2017-09-30 18:26:19 -05:00
Token | If provided, Grafana will upload the generated image via Slack's file.upload API method, not the external image destination.
2016-11-08 08:06:07 -06:00
2018-03-14 12:25:49 -05:00
If you are using the token for a slack bot, then you have to invite the bot to the channel you want to send notifications and add the channel to the recipient field.
2017-05-03 15:27:10 -05:00
### PagerDuty
2018-01-14 02:09:49 -06:00
To set up PagerDuty, all you have to do is to provide an API key.
2017-05-03 15:27:10 -05:00
Setting | Description
---------- | -----------
2018-01-14 02:09:49 -06:00
Integration Key | Integration key for PagerDuty.
2019-12-24 01:32:05 -06:00
Severity | Level for dynamic notifications, default is `critical`
2018-01-14 02:09:49 -06:00
Auto resolve incidents | Resolve incidents in PagerDuty once the alert goes back to ok
2017-05-03 15:27:10 -05:00
2016-11-08 00:04:46 -06:00
### Webhook
2018-01-14 02:09:49 -06:00
The webhook notification is a simple way to send information about a state change over HTTP to a custom endpoint.
Using this notification you could integrate Grafana into a system of your choosing.
2016-11-08 07:53:13 -06:00
2016-11-08 08:06:07 -06:00
Example json body:
2017-05-03 15:27:10 -05:00
2016-11-08 07:53:13 -06:00
```json
{
2019-12-18 07:03:59 -06:00
"dashboardId":1,
"evalMatches":[
2016-11-08 07:53:13 -06:00
{
2019-12-18 07:03:59 -06:00
"value":1,
"metric":"Count",
"tags":{}
2016-11-08 07:53:13 -06:00
}
2019-12-18 07:03:59 -06:00
],
"imageUrl":"https://grafana.com/assets/img/blog/mixed_styles.png",
"message":"Notification Message",
"orgId":1,
"panelId":2,
"ruleId":1,
"ruleName":"Panel Title alert",
"ruleUrl":"http://localhost:3000/d/hZ7BuVbWz/test-dashboard?fullscreen\u0026edit\u0026tab=alert\u0026panelId=2\u0026orgId=1",
"state":"alerting",
"tags":{
"tag name":"tag value"
},
"title":"[Alerting] Panel Title alert"
}```
2016-11-08 00:04:46 -06:00
2017-05-03 15:27:10 -05:00
- **state** - The possible values for alert state are: `ok` , `paused` , `alerting` , `pending` , `no_data` .
2016-11-08 00:04:46 -06:00
2017-07-10 05:22:21 -05:00
### DingDing/DingTalk
2017-07-10 05:16:40 -05:00
2017-07-10 05:22:21 -05:00
[Instructions in Chinese ](https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7629140.0.0.p2lr6t&treeId=257&articleId=105733&docType=1 ).
2017-07-10 05:16:40 -05:00
In DingTalk PC Client:
2017-07-10 05:22:21 -05:00
2018-10-16 21:24:05 -05:00
1. Click "more" icon on upper right of the panel.
2017-07-10 05:22:21 -05:00
2017-07-10 05:16:40 -05:00
2. Click "Robot Manage" item in the pop menu, there will be a new panel call "Robot Manage".
2017-07-10 05:22:21 -05:00
2018-11-28 13:33:41 -06:00
3. In the "Robot Manage" panel, select "customized: customized robot with Webhook".
2017-07-10 05:22:21 -05:00
2017-07-10 05:16:40 -05:00
4. In the next new panel named "robot detail", click "Add" button.
2017-07-10 05:22:21 -05:00
2017-07-10 05:16:40 -05:00
5. In "Add Robot" panel, input a nickname for the robot and select a "message group" which the robot will join in. click "next".
2017-07-10 05:22:21 -05:00
2017-07-10 05:16:40 -05:00
6. There will be a Webhook URL in the panel, looks like this: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxx. Copy this URL to the grafana Dingtalk setting page and then click "finish".
2018-10-24 09:28:59 -05:00
Dingtalk supports the following "message type": `text` , `link` and `markdown` . Only the `link` message type is supported.
2017-07-10 05:16:40 -05:00
2017-10-10 04:11:02 -05:00
### Kafka
2018-01-14 02:09:49 -06:00
Notifications can be sent to a Kafka topic from Grafana using the [Kafka REST Proxy ](https://docs.confluent.io/1.0/kafka-rest/docs/index.html ).
There are a couple of configuration options which need to be set up in Grafana UI under Kafka Settings:
2017-10-10 04:11:02 -05:00
1. Kafka REST Proxy endpoint.
2. Kafka Topic.
2018-01-14 02:09:49 -06:00
Once these two properties are set, you can send the alerts to Kafka for further processing or throttling.
2017-10-10 04:11:02 -05:00
2018-11-15 17:30:51 -06:00
### Google Hangouts Chat
Notifications can be sent by setting up an incoming webhook in Google Hangouts chat. Configuring such a webhook is described [here ](https://developers.google.com/hangouts/chat/how-tos/webhooks ).
2020-01-07 05:59:53 -06:00
### Squadcast
Squadcast helps you get alerted via Phone call, SMS, Email and Push notifications and lets you take actions on those alerts. Grafana notifications can be sent to Squadcast via a simple incoming webhook. Refer the official [Squadcast support documentation ](https://support.squadcast.com/docs/grafana ) for configuring these webhooks.
2019-04-23 01:00:55 -05:00
### All supported notifiers
2017-12-14 07:44:58 -06:00
2019-06-26 02:44:19 -05:00
Name | Type | Supports images | Support alert rule tags
-----|------|---------------- | -----------------------
2019-06-06 06:29:30 -05:00
DingDing | `dingding` | yes, external only | no
Discord | `discord` | yes | no
Email | `email` | yes | no
Google Hangouts Chat | `googlechat` | yes, external only | no
Hipchat | `hipchat` | yes, external only | no
Kafka | `kafka` | yes, external only | no
Line | `line` | yes, external only | no
Microsoft Teams | `teams` | yes, external only | no
2019-12-03 04:54:37 -06:00
OpsGenie | `opsgenie` | yes, external only | yes
2019-06-06 06:29:30 -05:00
Pagerduty | `pagerduty` | yes, external only | no
Prometheus Alertmanager | `prometheus-alertmanager` | yes, external only | yes
Pushover | `pushover` | yes | no
Sensu | `sensu` | yes, external only | no
Slack | `slack` | yes | no
2020-01-07 05:59:53 -06:00
Squadcast | `webhook` | no | no
2019-06-06 06:29:30 -05:00
Telegram | `telegram` | yes | no
Threema | `threema` | yes, external only | no
VictorOps | `victorops` | yes, external only | no
2019-08-03 10:00:40 -05:00
Webhook | `webhook` | yes, external only | yes
2016-11-08 00:04:46 -06:00
2017-05-03 15:27:10 -05:00
# Enable images in notifications {#external-image-store}
2019-12-05 10:12:00 -06:00
Grafana can render the panel associated with the alert rule as a PNG image and include that in the notification. Read more about the requirements and how to configure image rendering [here ]({{< relref "../administration/image_rendering/" >}} ).
2019-09-17 12:24:03 -05:00
Most Notification Channels require that this image be publicly accessible (Slack and PagerDuty for example). In order to include images in alert notifications, Grafana can upload the image to an image store. It currently supports
2019-12-05 10:12:00 -06:00
Amazon S3, Webdav, Google Cloud Storage and Azure Blob Storage. So to set that up you need to configure the [external image uploader ]({{< relref "../installation/configuration/#external-image-storage" >}} ) in your grafana-server ini config file.
2017-12-30 16:01:51 -06:00
2018-04-14 08:56:47 -05:00
Be aware that some notifiers requires public access to the image to be able to include it in the notification. So make sure to enable public access to the images. If you're using local image uploader, your Grafana instance need to be accessible by the internet.
2017-05-03 15:27:10 -05:00
2019-04-23 01:00:55 -05:00
Notification services which need public image access are marked as 'external only'.
2017-05-03 15:27:10 -05:00
2019-06-06 06:29:30 -05:00
# Use alert rule tags in notifications {#alert-rule-tags}
2019-06-28 09:32:42 -05:00
> Only available in Grafana v6.3+.
2019-06-06 06:29:30 -05:00
Grafana can include a list of tags (key/value) in the notification.
It's called alert rule tags to contrast with tags parsed from timeseries.
It currently supports only the Prometheus Alertmanager notifier.
This is an optional feature. You can get notifications without using alert rule tags.
2017-05-03 15:27:10 -05:00
# Configure the link back to Grafana from alert notifications
2016-11-08 00:04:46 -06:00
2018-01-14 02:09:49 -06:00
All alert notifications contain a link back to the triggered alert in the Grafana instance.
2019-12-05 10:12:00 -06:00
This url is based on the [domain ]({{< relref "../installation/configuration/#domain" >}} ) setting in Grafana.