Alert notifications

    This is done from the Notification channels page.

    1. In the Grafana side bar, hover your cursor over the Alerting (bell) icon and then click Notification channels.
    2. Click Add channel.
    3. Fill out the fields or select options described below.

    New notification channel fields

    • Name - Enter a name for this channel. It will be displayed when users add notifications to alert rules.
    • Type - Select the channel type. Refer to the for details.
    • Include Image - See Enable images in notifications for details.
    • Disable Resolve Message - When selected, this option disables the resolve message [OK] that is sent when the alerting state returns to false.
    • Send reminders - 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.

    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.

    These examples show how often and when reminders are sent for a triggered alert.

    NameTypeSupports imagesSupports alert rule tags
    DingDingdingdingyes, external onlyno
    discordyesno
    Emailemailyesno
    googlechatyes, external onlyno
    Hipchathipchatyes, external onlyno
    Kafkakafkayes, external onlyno
    Linelineyes, external onlyno
    Microsoft Teamsteamsyes, external onlyno
    opsgenieyes, external onlyyes
    Pagerdutypagerdutyyes, external onlyyes
    Prometheus Alertmanagerprometheus-alertmanageryes, external onlyyes
    yesno
    Sensusensuyes, external onlyno
    Sensu Gosensugoyes, external onlyno
    slackyesno
    Telegramtelegramyesno
    Threemathreemayes, external onlyno
    VictorOpsvictoropsyes, external onlyyes
    Webhookwebhookyes, external onlyyes

    Email

    To enable email notifications you have to set up SMTP settings 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. Be aware that if you use the local image storage email servers and clients might not be able to access the image.

    Note: Template variables are not supported in email alerts.

    Slack

    Alert notifications - 图2

    To set up Slack, you need to configure an incoming Slack webhook URL. You can follow on how to do that. If you want to include screenshots of the firing alerts in the Slack messages you have to configure either the external image destination in Grafana or a bot integration via Slack Apps. and use the token provided, which starts with “xoxb”.

    SettingDescription
    UrlSlack incoming webhook URL, or eventually the chat.postMessage Slack API endpoint.
    UsernameSet the username for the bot’s message.
    RecipientAllows you to override the Slack recipient. You must either provide a channel Slack ID, a user Slack ID, a username reference (@<user>, all lowercase, no whitespace), or a channel reference (#<channel>, all lowercase, no whitespace). If you use the chat.postMessage Slack API endpoint, this is required.
    Icon emojiProvide an emoji to use as the icon for the bot’s message. Ex :smile:
    Icon URLProvide a URL to an image to use as the icon for the bot’s message.
    Mention UsersOptionally mention one or more users in the Slack notification sent by Grafana. You have to refer to users, comma-separated, via their corresponding Slack IDs (which you can find by clicking the overflow button on each user’s Slack profile).
    Mention GroupsOptionally mention one or more groups in the Slack notification sent by Grafana. You have to refer to groups, comma-separated, via their corresponding Slack IDs (which you can get from each group’s Slack profile URL).
    Mention ChannelOptionally mention either all channel members or just active ones.
    TokenIf provided, Grafana will upload the generated image via Slack’s file.upload API method, not the external image destination. If you use the chat.postMessage Slack API endpoint, this is required.

    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.

    Opsgenie

    To setup Opsgenie you will need an API Key and the Alert API Url. These can be obtained by configuring a new Grafana Integration.

    To set up PagerDuty, all you have to do is to provide an integration key.

    SettingDescription
    Integration KeyIntegration key for PagerDuty.
    SeverityLevel for dynamic notifications, default is (1)
    Auto resolve incidentsResolve incidents in PagerDuty once the alert goes back to ok
    Message in detailsRemoves the Alert message from the PD summary field and puts it into custom details instead (2)

    Note: The tags Severity, Class, Group, dedup_key, and Component have special meaning in the Pagerduty Common Event Format - PD-CEF. If an alert panel defines these tag keys, then they are transposed to the root of the event sent to Pagerduty. This means they will be available within the Pagerduty UI and Filtering tools. A Severity tag set on an alert overrides the global Severity set on the notification channel if it’s a valid level.

    Using Message In Details will change the structure of the custom_details field in the PagerDuty Event. This might break custom event rules in your PagerDuty rules if you rely on the fields in payload.custom_details. Move any existing rules using custom_details.myMetric to custom_details.queries.myMetric. This behavior will become the default in a future version of Grafana.

    Note: The state tag overrides the current alert state inside the custom_details payload.

    Note: Grafana uses the Events API V2 integration. This can be configured for each service.

    VictorOps

    To configure VictorOps, provide the URL from the Grafana Integration and substitute $routing_key with a valid key.

    Pushover

    To set up Pushover, you must provide a user key and an API token. Refer to for instructions on how to generate them.

    Webhook

    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.

    Example json body:

    • state - The possible values for alert state are: ok, paused, alerting, pending, no_data.

    DingTalk supports the following “message type”: text, link and markdown. Only the link message type is supported. Refer to the configuration instructions in Chinese language.

    In DingTalk PC Client:

    1. Click “more” icon on upper right of the panel.

    2. Click “Robot Manage” item in the pop menu, there will be a new panel call “Robot Manage”.

    3. In the “Robot Manage” panel, select “customized: customized robot with Webhook”.

    4. In the next new panel named “robot detail”, click “Add” button.

    5. In “Add Robot” panel, input a nickname for the robot and select a “message group” which the robot will join in. click “next”.

    Discord

    To set up Discord, you must create a Discord channel webhook. For instructions on how to create the channel, refer to Intro to Webhooks.

    SettingDescription
    Webhook URLDiscord webhook URL.
    Message ContentMention a group using @ or a user using <@ID> when notifying in a channel.
    Avatar URLOptionally, provide a URL to an image to use as the avatar for the bot’s message.
    Use Discord’s Webhook UsernameUse the username configured in Discord’s webhook settings. Otherwise, the username will be ‘Grafana.’

    Alternately, use the notifier by appending /slack to a Discord webhook URL.

    Kafka

    Notifications can be sent to a Kafka topic from Grafana using the . There are a couple of configuration options which need to be set up in Grafana UI under Kafka Settings:

    1. Kafka REST Proxy endpoint.

    2. Kafka Topic.

    Once these two properties are set, you can send the alerts to Kafka for further processing or throttling.

    Google Hangouts Chat

    Notifications can be sent by setting up an incoming webhook in Google Hangouts chat. For more information about configuring a webhook, refer to .

    Alertmanager handles alerts sent by client applications such as Prometheus server or Grafana. It takes care of deduplicating, grouping, and routing them to the correct receiver. Grafana notifications can be sent to Alertmanager via a simple incoming webhook. Refer to the official for configuration information.

    Caution: In case of a high-availability setup, do not load balance traffic between Grafana and Alertmanagers to keep coherence between all your Alertmanager instances. Instead, point Grafana to a list of all Alertmanagers, by listing their URLs comma-separated in the notification channel configuration.

    Sensu Go

    Grafana alert notifications can be sent to Go as events via the API. This operation requires an API key. For information on creating this key, refer to Sensu Go documentation.

    Enable images in notifications

    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.

    You must configure an in order to receive images in alert notifications. If your notification channel requires that the image be publicly accessible (e.g. Slack, PagerDuty), configure a provider which uploads the image to a remote image store like Amazon S3, Webdav, Google Cloud Storage, or Azure Blob Storage. Otherwise, the local provider can be used to serve the image directly from Grafana.

    Notification services which need public image access are marked as ‘external only’.

    All alert notifications contain a link back to the triggered alert in the Grafana instance. This URL is based on the setting in Grafana.

    Notification templating

    The alert notification template feature allows you to take the value from an alert query and inject that into alert notifications.