Manage alerting policies

This document describes how to edit, list, and view your alerting policies by using the Google Cloud console. It also describes how to view the JSON representation of a policy and how to add alerting policies to a custom dashboard. When you add policies to a custom dashboard, you can view your policies in the same context as your metric data.

This document doesn't describe how to edit, list, and view your alerting policies by using the Cloud Monitoring API. For more information, see Manage alerting policies by API.

Before you begin

  1. To get the permissions that you need to create and modify alerting policies by using the Google Cloud console, ask your administrator to grant you the Monitoring Editor (roles/monitoring.editor) IAM role on your project. For more information about granting roles, see Manage access.

    You might also be able to get the required permissions through custom roles or other predefined roles.

    For more information about Cloud Monitoring roles, see Control access with Identity and Access Management.

  2. Ensure that you're familiar with the general concepts of alerting policies. For more information, see Alerting overview.

Edit, list, or delete alerting policies

  1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Alerting:

    Go to Alerting

    The Alerting page displays panes that list summary information, incidents, and alerting policies.

  2. Click See all policies in the Policies pane.

    The Policies page lists all policies, includes a filter bar, and for each policy, options to edit, copy, or delete the policy:

    • To filter the list of alerting policies, do one of the following:

      • Enter a name on the filter bar. For example, to display only policies whose name contains Example, enter Example. A case-sensitive comparison tests whether a policy is listed.
      • Click Filter policies, select the filter property, and then either enter a value for the filter or select a value from the menu.

      When you add multiple filters, a logical AND joins the filters.

  3. Optional: To view the details of a policy, click the name of the policy. For information about the Policy details page, see View an alerting policy.

  4. Optional: To edit or copy a policy, click More options, and select the corresponding option. Editing and copying a policy is similar to creating a metric-based alerting policy. However, not all fields can be modified. When done, click Save policy.

  5. Optional: To delete a policy, click More options and select Delete. In the confirmation dialog, select Delete.

    If you delete the alerting policy associated with an alert chart, then the alert chart no longer displays any data. For more information, see Alert chart doesn't display any data.

View an alerting policy

  1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Alerting:

    Go to Alerting

  2. To list all policies, click See all policies in the Policies pane.

  3. Find the policy that you want to view, and then select it.

For example, the following screenshot illustrates the details for the alerting policy named Test staging:

Sample alert-policy details page.

As shown in the previous image, the details page provides you information about the alerting policy:

  • To view incidents created by the policy, see the Incidents section.

  • To view the configured notification channels, see the Notification Channels section.

  • To view the additional information that you specified to be included with a notification, see the Documentation section.

  • To view the user-defined labels, view the Labels section. For examples that illustrate how you can use labels to manage your alerts, see Annotate alerts with labels.

  • To edit, copy, delete, download the JSON representation, or change the enabled state of the policy, use options in the toolbar. For example, to disable an alerting policy that is enabled, click Enabled and then select Disable in the confirmation dialog.

View the JSON representation of an alerting policy

When you create or modify an alerting policy by using the Cloud Monitoring API, you provide a JSON representation of that policy to the API method. You can create the JSON yourself by using the API documentation to guide the content. An alternative is to create a policy by using the Google Cloud console, and then download the policy to your local system. The JSON file that you downloaded can be edited and used as a template for other policies. For examples of policies described by JSON, see Sample policies.

To download the JSON representation of an alerting policy, do the following:

  1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Alerting:

    Go to Alerting

  2. Find the policy that you want to view, and then click the policy name to open the Policy details page.
  3. Click JSON.

To view the JSON representation of an alerting policy when you're editing it, click  View code.

Add alerting policy to dashboard

To view your alerting policies in the same context as your metric data, add those policies to a custom dashboard. When you view that dashboard, it shows a chart for each alerting policy that you added. These charts display the monitored metric, the threshold, and the number of open incidents for the policy. These charts also contain links that let you view or edit the policy.

You can add policies with one condition to custom dashboards. Policies that contain multiple conditions can be viewed only from the alerting context.

To display a summary of an alerting policy on a custom dashboard, do the following:

  1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Dashboards:

    Go to Dashboards

  2. Select a dashboard or click Create dashboard.
  3. In the toolbar, click  Add widget.
  4. In the Add widget dialog, select Alert Policy.
  5. Click Alert policy, and then select an alerting policy. Only single-condition alerting policies can be selected from the Alert policy menu.
  6. To apply your changes to the dashboard, in the toolbar, click Apply. To discard your changes, click Cancel.

The following screenshot illustrates an alert chart:

Example of an alert chart.

In this example, the alerting policy is monitoring the CPU usage of two different virtual machines. The dashed line shows the condition threshold, which is set to 50%. The green chip with the label No incidents indicates that there are no open incidents for the alerting policy. If you place your pointer on the chip that shows the number of open incidents, then a dialog opens that links to the underlying alerting policy.

For more information, see Display alert charts and incidents on a dashboard.