Create alerting policy that monitors a resource group

This document describes how to use the Google Cloud console to create an alerting policy that monitors a metric for a specific resource group. A resource group is a dynamic collection of resources, where membership in the group is defined by some criteria. For example, you might define a resource group for the Compute Engine virtual machine (VM) instances that you use for production. After you create that group, you can then create an alerting policy that monitors only that group of instances. When you add a VM that matches the group criteria, the alerting policy automatically monitors that VM.

This content does not apply to log-based alerting policies. For information about log-based alerting policies, which notify you when a particular message appears in your logs, see Monitoring your logs.

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 to projects, folders, and organizations.

    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 information about these topics, see Alerting overview.

  3. Configure the notification channels that you want to use to receive any alerts. For redundancy purposes, we also recommend that you create multiple types of notification channels. For information about these steps, see Create and manage notification channels.

  4. Configure the resource group that you want to monitor.

Create alerting policy

To create an alerting policy that monitors a resource-group by using the Cloud Monitoring API, the filter expression must specify a group.id. For an example of a JSON file that specifies this field, see Group-aggregate policy.

To create an alerting policy that monitors a resource-group by using the Google Cloud console, do the following:

  1. In the Google Cloud console, go to the  Alerting page:

    Go to Alerting

    If you use the search bar to find this page, then select the result whose subheading is Monitoring.

  2. Select Create policy.
  3. Expand the Select a metric menu and select the metric type that you want to monitor.

  4. Restrict the resources to those in a Monitoring group:

    1. Click Add Filter and select Group.
    2. Expand Value and select the group name.
    3. Click Done.

    You can't modify the group while the group is being used by an alerting policy.

  5. Complete the alerting policy. You must configure the condition trigger, notifications, documentation, and policy name, and then click Create policy.

For more information about the settings in an alerting policy, see Create metric-threshold alerting policies.