|
| 1 | ++++ |
| 2 | +title = "Alerting Notifications" |
| 3 | +description = "Alerting Notifications Guide" |
| 4 | +keywords = ["Grafana", "alerting", "guide", "notifications"] |
| 5 | +type = "docs" |
| 6 | +[menu.docs] |
| 7 | +name = "Notifications" |
| 8 | +parent = "alerting" |
| 9 | +weight = 2 |
| 10 | ++++ |
| 11 | + |
| 12 | + |
| 13 | +# Alert Notifications |
| 14 | + |
| 15 | +{{< imgbox max-width="40%" img="/img/docs/v4/alert_notifications_menu.png" caption="Alerting notifications" >}} |
| 16 | + |
| 17 | +> Alerting is only available in Grafana v4.0 and above. |
| 18 | +
|
| 19 | +When an alert changes state it sends out notifications. Each alert rule can have |
| 20 | +multiple notifications. But in order to add a notification to an alert rule you first need |
| 21 | +to add and configure a `notification` object. This is done from the Alerting/Notifications page. |
| 22 | + |
| 23 | +## Notification Setup |
| 24 | + |
| 25 | +On the notifications list page hit the `New Notification` button to go the the page where you |
| 26 | +can configure and setup a new notification. |
| 27 | + |
| 28 | +You specify name and type, and type specific options. You can also test the notification to make |
| 29 | +sure it's working and setup correctly. |
| 30 | + |
| 31 | +### Send on all alerts |
| 32 | + |
| 33 | +When checked this option will make this notification used for all alert rules, existing and new. |
| 34 | + |
| 35 | +## Supported notification types |
| 36 | + |
| 37 | +Grafana ships with a set of notification types. More will be added in future releases. |
| 38 | + |
| 39 | +### Email |
| 40 | + |
| 41 | +To enable email notification you have to setup [SMTP settings](/installation/configuration/#smtp) |
| 42 | +in the Grafana config. Email notification will upload an image of the alert graph to an |
| 43 | +external image destination if available or fallback on attaching the image in the email. |
| 44 | + |
| 45 | +### Slack |
| 46 | + |
| 47 | +{{< imgbox max-width="40%" img="/img/docs/v4/slack_notification.png" caption="Alerting Slack Notification" >}} |
| 48 | + |
| 49 | +To set up slack you need to configure an incoming webhook url at slack. You can follow their guide for how |
| 50 | +to do that https://api.slack.com/incoming-webhooks If you want to include screenshots of the firing alerts |
| 51 | +in the slack messages you have to configure the [external image destination](#external-image-store) in Grafana. |
| 52 | + |
| 53 | +Setting | Description |
| 54 | +---------- | ----------- |
| 55 | +Recipient | allows you to override the slack recipient. |
| 56 | +Mention | make it possible to include a mention in the slack notification sent by Grafana. Ex @here or @channel |
| 57 | + |
| 58 | +### Webhook |
| 59 | + |
| 60 | +The webhook notification is a simple way to send information about an state change over HTTP to a custom endpoint. |
| 61 | +Using this notification you could integrated Grafana into any system you choose, by yourself. |
| 62 | + |
| 63 | +Example json body: |
| 64 | +```json |
| 65 | +{ |
| 66 | + "title": "My alert", |
| 67 | + "ruleId": 1, |
| 68 | + "ruleName": "Load peaking!", |
| 69 | + "ruleUrl": "http://url.to.grafana/db/dashboard/my_dashboard?panelId=2", |
| 70 | + "state": "Alerting", |
| 71 | + "imageUrl": "http://s3.image.url", |
| 72 | + "evalMatches": [ |
| 73 | + { |
| 74 | + "metric": "requests", |
| 75 | + "tags": {}, |
| 76 | + "value": 122 |
| 77 | + } |
| 78 | + ] |
| 79 | +} |
| 80 | +``` |
| 81 | + |
| 82 | +### PagerDuty |
| 83 | + |
| 84 | +To set up PagerDuty, all you have to do is to provide an api key. |
| 85 | + |
| 86 | +Setting | Description |
| 87 | +---------- | ----------- |
| 88 | +Integration Key | Integration key for pagerduty. |
| 89 | +Auto resolve incidents | Resolve incidents in pagerduty once the alert goes back to ok |
| 90 | + |
| 91 | + |
| 92 | +# Enable images in notifications {#external-image-store} |
| 93 | + |
| 94 | +Grafan can render the panel associated with the alert rule and include that in the notification. Some types |
| 95 | +of notifications require that this image be publicly accessable (Slack for example). In order to support |
| 96 | +images in notifications like Slack Grafana can upload the image to an image store. It currently supports |
| 97 | +Amazon S3 for this and Webdav. So to set that up you need to configure the |
| 98 | +[external image uploader](/installation/configuration/#external-image-storage) in your grafana-server ini |
| 99 | +config file. |
| 100 | + |
| 101 | +This is not an optional requirement, you can get slack and email notifications without setting this up. |
| 102 | + |
| 103 | + |
0 commit comments