Notification options

Using the Google Cloud Console

This page lists the supported notification channel types and explains how to configure them.

Configuring notification channels

You must configure most notification channels before you use them in alerting policies.

To configure a notification channel, do the following:

  1. In the Cloud Console, select Monitoring:

    Go to Monitoring

  2. In the Monitoring navigation pane, click Alerting.

  3. Click Edit notification channels. The Notification channels dashboard contains a section for each notification channel type. Below the section header is a list of all configurations for that type:

    • To modify an entry, click Edit . Click Save after your changes are complete.
    • To delete an entry, click Delete . Click Delete in the confirmation dialog.
  4. To add an entry, follow the notification-type instructions in the following table:

Email

You don't need to configure email addresses in advance.

(Optional) To add an email, go to the Email section, click Add new and follow the instructions.

If you create an alerting policy and select Email in the Notifications section, then enter your email address. If you use a group email address, then configure the group to accept mail from alerts@stackdriver.com.

Google Cloud Console Mobile App

Use the Google Cloud Console Mobile App to monitor your Cloud Console resources and Monitoring information from anywhere.

To configure your mobile device to receive Monitoring notifications, do the following:

  1. Install Google Cloud Console Mobile App from your mobile device's app store.
  2. In Google Cloud Console Mobile App: Select the Settings menu to configure the app for your Workspace. You will be able to see your Cloud Console resources.
  3. In the Mobile Devices section, click Add new and follow the instructions.

    After a few minutes, your mobile device will be listed under the Mobile Devices.

    When you create an alerting policy, select Google Cloud Console (mobile) in the Notifications section, and choose your mobile device from the list.

PagerDuty

Integration with PagerDuty allows for one-way or two-way incident resolution with Monitoring.

To set up PagerDuty notifications, do the following:

  1. In PagerDuty: Create a PagerDuty account at the PagerDuty site. You can optionally configure PagerDuty Sync for two-way sync with Monitoring.

    For more information, see PagerDuty's Stackdriver Integration Guide.

  2. In the PagerDuty section, click Add new.

  3. Enter the Service Name and the Service Key.

  4. Click Save.

    When you create an alerting policy, select PagerDuty in the Notifications section and choose your PagerDuty configuration.

    In this document, the screenshots for Stackdriver are from an older version of Stackdriver, but the information is accurate.

SMS

To configure SMS notifications, do the following:

  1. In the SMS section, click Add new and follow the instructions.
  2. Click Save.

    When you set up your alerting policy, select the SMS notification type and choose a verified phone number from the list.

Slack

The Monitoring Slack integration allows your alerting policies to post to a Slack channel when a new incident is created. To set up Slack notifications, do the following:

  1. In Slack: Create a Slack channel at the Slack site. Record the channel URL.
  2. In the Monitoring console, select Monitoring:

    Go to Monitoring

  3. Click Alerting and then click Edit notification channels.

  4. In the Slack section, click Add new. This brings you to the Slack sign-in page:

    1. Enter your Slack workspace URL.
    2. Click Allow to enable Google Cloud Monitoring access to your Slack workspace.

    When you create an alerting policy, select Slack in the Notifications section and choose your Slack configuration.

Webhooks

To configure Webhooks notifications, do the following:

  1. The webhook handler: Identify an endpoint URL that will receive webhook data from Monitoring.
  2. In the Webhooks section, click Add new and follow the instructions.
  3. Click Save.

    When you create an alerting policy, select Webhook in the Notifications section and choose your webhook configuration.

Pub/Sub

To send notifications to a Pub/Sub topic, do the following:

  1. Create a Pub/Sub topic, as described in Creating a topic, if you don't already have one. The topic must exist before you can use it as a notification channel. The following command creates a topic called notificationTopic.

    gcloud pubsub topics create notificationTopic
  2. Create a notification channel that uses the topic. You must use the Monitoring API or the gcloud command-line tool to create this channel; see Creating channels for information and examples.

  3. Authorize the notifications service account to publish to each Pub/Sub topic that you are using as a notification channel.

    When you create the first Pub/Sub channel, Stackdriver Monitoring creates a service account for the Monitoring Notification Service Agent, for the project in which the channel was created. This service account manages the sending of notifications to Pub/Sub-based notification channels in this project.

    This service account has an ID with the following structure:

    service-[PROJECT_NUMBER]@gcp-sa-monitoring-notification.iam.gserviceaccount.com

    You can see this account on the IAM page, not the Service accounts page, of the Google Cloud Console.

    To authorize this account to publish to a topic, you must give the service account the pubsub.publisher IAM role for the topic. The following command does this for the notificationTopic topic:

    gcloud pubsub topics add-iam-policy-binding \
    projects/[PROJECT_NUMBER]/topics/notificationTopic --role=roles/pubsub.publisher \
    --member=serviceAccount:service-[PROJECT_NUMBER]@gcp-sa-monitoring-notification.iam.gserviceaccount.com
    

    If the command succeeds, it returns output like the following:

    Updated IAM policy for topic [notificationTopic].
    bindings:
    ‐ members:
      ‐ serviceAccount:service-[PROJECT_NUMBER]@gcp-sa-monitoring-notification.iam.gserviceaccount.com
      role: roles/pubsub.publisher
    etag: BwWcDOIw1Pc=
    version: 1
    

    For more information, see the pubsub topics add-iam-policy-binding reference page.

    Note that the project number is not the same as the project ID. Project IDs are typically strings that reflect the project name, like my-test-project. Project numbers are unique numerical identifiers. You can find the project name, ID, and number on the project's landing page in the Google Cloud Console, or you can retrieve it with the following command:

    gcloud projects describe [PROJECT_ID] --format="value(project_number)"
    
  4. Add the Pub/Sub channel to an alerting policy by selecting Pub/Sub as the channel type and a named topic as the notification channel.

Using the Stackdriver Monitoring console

When you create an alerting policy, you can have up to 16 notification channels to use for incidents. This page lists the supported notification channel types and explains how to configure them.

Profile and Workspace settings

You must configure most notification channels before you use them in alerting policies. To configure a notification channel, you must have Editor access to the Workspace.

Notifications are configured in two places in Monitoring:

  • The Profile page is where you configure SMS notifications and the Google Cloud Console Mobile App. To configure your profile, click on your name in the Stackdriver Monitoring console and select Profile.

  • The Workspace Settings page is where you configure other notification channels. To configure your notifications, click on the Workspace name in the Monitoring console and select Workspace Settings. Then select Notifications and the type of notification.

Other users with Editor access to your Workspace can enter their own notification information. You will see their configurations, as well as your own, when you set up notification options for your alerting policy.

Email

When you create an alerting policy, select Email in the Notifications section and enter your email address. It's not necessary to configure email addresses before setting up your alerting policy. If you use a group email address, be sure to configure the group to accept mail from alerts@stackdriver.com.

If you wish to manage your project's existing email notification addresses, do the following:

  1. In the Cloud Console, select Monitoring:

    Go to Monitoring

  2. Click Menu next to your Workspace name, and select Workspace Settings > Notifications > Email.

    From here, you can select email addresses to change or delete:

    Notification setup for email.

Google Cloud Console Mobile App

Use Google Cloud Console Mobile App to monitor your Cloud Console resources and Monitoring information from anywhere.

To configure your mobile device to receive Monitoring notifications, do the following:

  1. Install Google Cloud Console Mobile App from your mobile device's app store.
  2. In Google Cloud Console Mobile App: Select the Settings menu to configure the app for your Workspace. You will be able to see your Cloud Console resources.
  3. In the Cloud Console, select Monitoring.

    Go to Monitoring

  4. In the Monitoring navigation bar, click your name to open your profile.

  5. Add your mobile devices to your profile.

When you create an alerting policy, select Google Cloud Console (mobile) in the Notifications section, and choose your mobile device from the list.

PagerDuty

Integration with PagerDuty allows for one-way or two-way incident resolution with Monitoring:

  • One-way sync: When an incident is created, it is opened in both Stackdriver Monitoring and Pagerduty.
  • Two-way sync: When an incident is created, Stackdriver Monitoring and Pagerduty reconcile the incident statuses. Note that closing a Pagerduty incident doesn't close an open Stackdriver Monitoring incident.

To set up PagerDuty notifications, do the following:

  1. Navigate to the PagerDuty site. If you don't already have a PagerDuty account, create one.

  2. Follow PagerDuty's Stackdriver Integration Guide.

    When following these instructions, you're asked to select the Incident behavior. This choice determines whether you get one- or two-way sync.

    • For one-way sync, select Create alerts and incidents.
    • For two-way sync, select Create incidents.
  3. In the Cloud Console, select Monitoring:

    Go to Monitoring

  4. Click Menu next to your Workspace name, and select Workspace Settings > Notifications > PagerDuty.

  5. Click Add PagerDuty Service.

  6. Specify the Service Name and Service Key.

  7. Click Save.

When you create an alerting policy, select PagerDuty in the Notifications section and choose your PagerDuty configuration.

In this document, the screenshots for Stackdriver Monitoring are from an older version of Monitoring, but the information is accurate.

Pub/Sub

This option is not supported in the Stackdriver Monitoring console. To use a Pub/Sub topic as a notification channel, follow the steps for Pub/Sub under Using the Google Cloud Console.

SMS

To configure SMS notifications, do the following:

  1. In the Cloud Console, select Monitoring:

    Go to Monitoring

  2. Click Menu next to your Workspace name, and select Workspace Settings > Notifications > SMS.

  3. Click Add phone number and follow the instructions, including the verification steps.

When you set up your alerting policy, select the SMS notification type and choose a verified phone number from the list.

Slack

The Monitoring Slack integration allows your alerting policies to post to a Slack channel when a new incident is created. To set up Slack notifications, do the following:

  1. In Slack: Create a Slack channel in the Slack site.

  2. In the Monitoring console, select Monitoring:

    Go to Monitoring

  3. Click Menu next to your Workspace name, and select Workspace Settings > Notifications > Slack.

  4. Click Authorize Stackdriver and follow the instructions on the Slack website.

    Notification setup for Slack.

When you create an alerting policy, select Slack in the Notifications section and choose your Slack configuration.

Webhooks

Monitoring supports webhooks to notify remote services about incidents that occur. To set up webhooks notifications, do the following:

  1. The webhook handler: Identify an endpoint URL that will receive webhook data from Monitoring.
  2. In the Cloud Console, select Monitoring:

    Go to Monitoring

  3. Click Menu next to your Workspace name, and select Workspace Settings > Notifications > Webhooks.

  4. Click Add Webhook and follow the instructions. The page has a sample of the data that will be sent to the endpoint, and some authorization options.

    Notification setup for webhooks.

When you create an alerting policy, select Webhook in the Notifications section and choose your webhook configuration.

The sample message shown on the configuration page is the JSON representation of an incident. This indicates which alerting policy was triggered, when, the current status of the incident, and so forth. See Incidents and events for more information. For information on using variables in messages, see Variables in documentation templates.