Criar uma política de alertas que monitora um grupo de recursos
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Neste documento, descrevemos como usar o console do Google Cloud para criar uma política de alertas que monitora uma métrica de um grupo de recursos específico.
Um grupo de recursos é um conjunto dinâmico de recursos, em que a associação ao
grupo é definida por alguns critérios. Por exemplo, é possível definir um grupo de recursos para as instâncias de máquina virtual (VM) do Compute Engine usadas na produção. Depois de criar esse grupo, você pode
criar uma política de alertas que monitore apenas esse grupo de instâncias. Quando
você adiciona uma VM que corresponde aos critérios do grupo, a política de alertas
monitora automaticamente essa VM.
Este conteúdo não se aplica a políticas de alertas baseadas em registros.
Para informações sobre políticas de alertas baseadas em registros, que informam quando uma mensagem específica aparece nos registros, consulte
Como monitorar os registros.
Antes de começar
Para ter as permissões necessárias para criar e modificar políticas de alertas usando o console do Google Cloud ,
peça ao administrador para conceder a você o
papel do IAM de Editor do Monitoring (roles/monitoring.editor)
no seu projeto.
Para mais informações sobre a concessão de papéis, consulte Gerenciar o acesso a projetos, pastas e organizações.
Familiarize-se com os conceitos gerais das políticas de alertas.
Para informações sobre esses tópicos, consulte
Visão geral de alertas.
Configure os canais de notificação que você quer usar para receber alertas. Para fins de redundância, também recomendamos que você crie vários tipos de canais de notificação. Para informações sobre essas etapas,
consulte Criar e gerenciar canais de notificação.
Para criar uma política de alertas que monitore um grupo de recursos usando a
API Cloud Monitoring, a expressão de filtro precisa especificar um group.id. Para
um exemplo de arquivo JSON que especifica esse campo,
consulte Política de agregação de grupo.
Para criar uma política de alertas que monitore um grupo de recursos usando o
consoleGoogle Cloud , faça o seguinte:
No console Google Cloud , acesse a página notificationsAlertas:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-28 UTC."],[],[],null,["# Create alerting policy that monitors a resource group\n\nThis document describes how to use the Google Cloud console to create an alerting\npolicy that monitors a metric for a specific [resource group](/monitoring/groups).\nA *resource group* is a dynamic collection of resources, where membership in the\ngroup is defined by some criteria. For example, you might\ndefine a resource group for the Compute Engine virtual machine (VM) instances\nthat you use for production. After you create that group, you can then\ncreate an alerting policy that monitors only that group of instances. When\nyou add a VM that matches the group criteria, the alerting policy\nautomatically monitors that VM.\n\n\nThis content does not apply to log-based alerting policies.\nFor information about log-based alerting policies, which notify you when a\nparticular message appears in your logs, see\n[Monitoring your logs](/logging/docs/alerting/monitoring-logs).\n\nBefore you begin\n----------------\n\n1.\n\n To get the permissions that\n you need to create and modify alerting policies by using the Google Cloud console,\n\n ask your administrator to grant you the\n\n\n [Monitoring Editor](/iam/docs/roles-permissions/monitoring#monitoring.editor) (`roles/monitoring.editor`)\n IAM role on your project.\n\n\n For more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\n You might also be able to get\n the required permissions through [custom\n roles](/iam/docs/creating-custom-roles) or other [predefined\n roles](/iam/docs/roles-overview#predefined).\n\n For more information about Cloud Monitoring roles,\n see [Control access with Identity and Access Management](/monitoring/access-control).\n2. Ensure that you're familiar with the general concepts of alerting policies.\n For information about these topics, see\n [Alerting overview](/monitoring/alerts).\n\n3. Configure the notification channels that you want to use to receive any\n alerts. For redundancy purposes, we also recommend that you create\n multiple types of notification channels. For information about these steps,\n see [Create and manage notification channels](/monitoring/support/notification-options).\n\n4. Configure the [resource group](/monitoring/groups) that you want to monitor.\n\nCreate alerting policy\n----------------------\n\nTo create an alerting policy that monitors a resource-group by using the\nCloud Monitoring API, the filter expression must specify a `group.id`. For\nan example of a JSON file that specifies this field,\nsee [Group-aggregate policy](/monitoring/alerts/policies-in-json#json-group-aggr).\n\nTo create an alerting policy that monitors a resource-group by using the\nGoogle Cloud console, do the following:\n\n1. In the Google Cloud console, go to the\n *notifications* **Alerting** page:\n\n [Go to **Alerting**](https://console.cloud.google.com/monitoring/alerting)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. Select **Create policy**.\n3. Expand the **Select a metric** menu and select the metric type that you want\n to monitor.\n\n4. Restrict the resources to those in a Monitoring group:\n\n 1. Click **Add Filter** and select **Group**.\n 2. Expand *arrow_drop_down* **Value** and select the group name.\n 3. Click **Done**.\n\n You can't modify the group while the group is being used by an\n alerting policy.\n5. Complete the alerting policy. You must configure the condition trigger,\n notifications, documentation, and policy name,\n and then click **Create policy**.\n\nFor more information about the settings in an alerting policy, see\n[Create metric-threshold alerting policies](/monitoring/alerts/using-alerting-ui)."]]