Using resource groups

Cloud Monitoring lets you define a set of resources as a group. After you define a group, you can set up alerting policies, charts, and dashboards to monitor the group. You can create up to 500 groups per metrics scope .

About groups

Groups provide a mechanism for alerting on the behavior of a set of resources, rather than on individual resources. For example, you can create an alerting policy that is triggered if some number of resources in the group violates a particular condition (for example, CPU load), rather than having each resource inform you of violations individually.

You define the membership criteria for your groups. A resource belongs to a group if the resource meets the membership criteria of the group. Membership criteria can be based on labels, regions, applications, and other criteria. Resources can belong to multiple groups.

The set of members in a group is dynamic, making groups useful for monitoring changing environments. For example, if you create a group whose membership criteria specifies a geographic region, then new resources in that region are automatically added to the group. You don't have to modify dashboards or alerting policies if the group membership changes.

Groups can contain subgroups, up to six levels deep. One application for groups and subgroups is management of physical or logical topologies. For example, with groups, you can separate your monitoring of production resources from your monitoring of test or development resources. You can also create subgroups to monitor your production resources by zone.

Using groups

When you create a group, Monitoring creates a dashboard for it. In addition to the standard dashboard controls, group dashboards provide controls to do the following:

  • Edit or delete the group.
  • Manage the alerting policies that depend on the group.
  • Create and view subgroups.
  • View incidents.
  • View events.
  • View group resources.
  • Access group resource dashboards.

Group dashboards are limited to 40 charts. Charts on a group dashboard display data only from the members of the group.

The following screenshot is the default dashboard for the group "My instances":

Default group dashboard for the My instances group.

Overview of your resource groups

To see a summary of the status of all your groups, select Groups in the Monitoring menu of the Cloud Console. You can add filters to modify which groups are listed. To add a filter, click Filter table, and make a selection for the filter type. Based on the type you select, make a selection for the filter value or enter the value.

For any group on the Groups window, you can do all of the following:

  • View a group's dashboard by clicking on the group's display name.
  • Edit the group by clicking Edit
  • Delete the group by clicking Delete
  • View the associated alerting policies by clicking Policies
  • View the number VM instance and the number of resources in the group

Using the Google Cloud Console

Creating a group

To create a group, do the following:

  1. In the Cloud Console, select Monitoring:

    Go to Monitoring

  2. In the navigation pane, select Groups.

  3. Click Create Group. The following screenshot shows the Create group dialog:

    Group-creation panel.

  4. Replace Name with a display name for the group. The display name isn't required to be unique in the project.

  5. Add the group membership criteria. See the next section, Specifying membership criteria, for more information.

  6. Click Create.

Specifying membership criteria

A group can have multiple membership criteria.

To specify a single criterion, do the following in the Create group dialog:

  1. Click Add Criteria.

  2. In the Add criteria dialog, select the Type of criterion from the menu:

    • Name: (Default) Group membership is determined by the display name of the resource.
    • Tag: Group membership is determined by tags. For this option, a secondary menu of resource values that are dependent on your configuration is displayed. For example, if you've created Compute Engine instances and have assigned network tags or labels to the instances, these tags and labels are listed in the secondary menu.

    • Region: The location of the resource.

    • Security Group: Group membership is determined by Role Based Access Control (RBAC). For example, you can specify a security group when you are creating a Google Kubernetes Engine cluster. For more information, see the Kubernetes reference page Using RBAC Authorization.

    • Cloud Account/Project: Your Google Cloud project.

    • App Engine App: Your App Engine applications.

    • App Engine Service: App Engine services such as the Users API, Memcache, and Images API.

  3. If you select a Name or Tag criterion, then an Operator menu is displayed. In this case, select how the comparison is to be performed. By default, the comparison operation is set to Contains.

    For example, if you don't want your group to contain any resources with instance in the name, you might set type to Name, value to instance, and the operator to Does not contain.

    When the Operator menu isn't displayed, the comparison operator is Equals.

  4. Enter the value to be matched.

  5. Click Done.

If you want to add a criterion, then repeat the previous procedure. When you have multiple criteria, you set how the criterion are to be combined with the Combine criteria operator selector. Choose AND if membership requires that a resource satisfy every criterion. Choose OR if membership requires that a resource satisfy a single criterion.

The following screenshot shows the group definition for a group named "My instances":

Create a group of resources named instance.

In this example, there are 2 criterion, both of which must be met.

Deleting a group

To delete a group, do the following:

  1. Begin the delete action by choosing 1 approach:

    • In the Groups window, identify the group to delete and click Delete .
    • In the group detail view, click Delete .
  2. In the Delete group and subgroup dialog, click Delete to confirm the action to delete the group and its subgroups. If you delete a group, you also remove the group from alerting policies and uptime checks.

Editing a group

To edit a group, choose 1 approach:

  • In the Groups window, identify the group to edit and click Edit .
  • In the group detail view, click Edit .

Viewing associated alerting policies

To view the alerting policies that depend on a group, do the following:

  1. Go to the groups detail view.
  2. Click Policies . The Policies dialog includes the following:

    • Link to each policy.
    • Toggle to enable or disable the policy.
    • Create Policy button.

Creating an alerting policy for the group

To create an alerting policy that uses the group, in the Add conditions window, do the following:

  1. Click Filter and select Group.
  2. Click Menu and select the group name.
  3. Click Apply.

Using the API

You can create, modify, retrieve, and delete groups by using the projects.groups API. However, groups created by using the API are not editable in the UI.

In the API, groups are identified by a groupId field. This is an identifier assigned by Cloud Monitoring when you create the group. The value you provide for the group in the Group Name field is a display-only name, stored in a displayName field.

You can also use monitoring filters to:

What's next