Configura alertas para programaciones de instantáneas
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Linux
Windows
Puedes crear una métrica personalizada para generar alertas o proporcionar información para solucionar problemas relacionados con las instantáneas programadas.
Por ejemplo, para configurar una alerta de fallas de instantáneas programadas, hace el siguiente procedimiento:
Crea una métrica basada en el filtro de registro que cuenta las fallas de las instantáneas programadas.
Crea una política de alertas para enviar una alerta cuando se produzca una falla en las instantáneas programadas.
Antes de comenzar
Si aún no lo hiciste, configura la autenticación.
La autenticación verifica tu identidad para acceder a los Google Cloud servicios y las APIs. Para ejecutar código o muestras desde un entorno de desarrollo local, puedes autenticarte en Compute Engine seleccionando una de las siguientes opciones:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
gcloud
Instala Google Cloud CLI.
Después de la instalación,
inicializa Google Cloud CLI ejecutando el siguiente comando:
Para obtener más información, consulta
Autentícate para usar REST
en la documentación de autenticación de Google Cloud .
Roles y permisos requeridos
Para obtener los permisos que
necesitas para crear una programación de instantáneas,
pídele a tu administrador que te otorgue los
siguientes roles de IAM en el proyecto:
En Métricas definidas por el usuario (User-defined Metrics), busca la nueva métrica llamada
user/scheduled_snapshot_failure_count.
Haz clic en el botón de menú more_vertMás
en esta fila y elige Crear alerta de métrica (Create alert from metric). Se abrirá
la página de creación de condiciones de la política de alertas.
En el panel Destino en el Agregador, selecciona ninguno.
En Filtro, haz lo siguiente:
Haz clic en Agregar un filtro.
Selecciona un estado de la lista.
En el campo Valor, escribe DONE (LISTO).
Haz clic en Aplicar.
Haga clic en Show advanced options.
En el panel Agregación avanzada, haz clic en la lista Alineador y selecciona
sum.
En el panel Configuración, selecciona los siguientes valores:
Activadores de condición si: Any time series violates
Condición: is above
Umbral: 1
Para:: most recent value
Haz clic en Guardar.
En la página Crea una política de alertas nueva, ingresa el nombre de una política.
De forma opcional, puedes agregar canales de notificaciones y documentación para
esta política.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[[["\u003cp\u003eYou can create custom metrics to monitor and troubleshoot scheduled snapshot issues, such as failures.\u003c/p\u003e\n"],["\u003cp\u003eTo set up alerts for scheduled snapshot failures, you must create a log filter, a metric based on the log filter, and finally an alert policy.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication is required to access Google Cloud services and APIs, which can be set up through the gcloud CLI or the console.\u003c/p\u003e\n"],["\u003cp\u003eTo create a snapshot schedule, you need specific IAM roles, including Compute Instance Admin (v1) and Service Account User (v1).\u003c/p\u003e\n"],["\u003cp\u003eAfter creating the user metric you can set an alert policy to trigger any time the metric exceeds the threshold, which in this case is one failure.\u003c/p\u003e\n"]]],[],null,["# Configure alerts for snapshot schedules\n\nLinux Windows\n\n*** ** * ** ***\n\nYou can [create a custom metric](/monitoring/custom-metrics)\nto raise alerts or provide information to troubleshoot problems with scheduled\nsnapshots.\n\nFor example, to set up an alert for scheduled snapshot failures, use the\nfollowing procedure:\n\n1. [Create a log filter](#ss_alert_filter) to capture scheduled snapshot events.\n2. [Create a metric](#ss_alert_metric) based off of the log filter that counts scheduled snapshot failures.\n3. [Create an alert policy](#ss_alert_policy) to send an alert when there is a scheduled snapshot failure.\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\n### Required roles and permissions\n\n\nTo get the permissions that\nyou need to create a snapshot schedule,\n\nask your administrator to grant you the\nfollowing IAM roles on the project:\n\n- [Compute Instance Admin (v1)](/iam/docs/roles-permissions/compute#compute.instanceAdmin.v1) (`roles/compute.instanceAdmin.v1`)\n- To connect to a VM that can run as a service account: [Service Account User (v1)](/iam/docs/roles-permissions/iam#iam.serviceAccountUser) (`roles/iam.serviceAccountUser`)\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nCreate a log filter\n-------------------\n\nCreate a log filter to capture scheduled snapshot events. \n\n### Console\n\n1. In the Google Cloud console, go to the\n **Logging \\\u003e Logs Explorer** page.\n\n [Go to the Logs Explorer page](https://console.cloud.google.com/logs/query)\n2. In the **Filter by label or text search** list, select **Convert to advanced filter**.\n\n1. Replace the filter field by entering the following text, replacing\n \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your project ID:\n\n resource.type=\"gce_disk\"\n logName=\"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/logs/cloudaudit.googleapis.com%2Fsystem_event\"\n protoPayload.methodName=\"ScheduledSnapshots\"\n severity\u003e\"INFO\"\n\n2. Click **Submit Filter**.\n\nCreate a metric\n---------------\n\nAfter you create the log filter, create a metric that\ncounts scheduled snapshot failures. \n\n### Console\n\n1. On the **Logs Explorer** page, click **Create metric**.\n\n2. In the **Metric Editor**, enter the following:\n\n - **Name** : `scheduled_snapshot_failure_count`.\n - **Description** : `count of scheduled snapshot failures`.\n - **Type** : `Counter`\n3. Under **Labels** , click **Add item** and enter the following:\n\n - **Name** : `status`\n - **Description** : `status of scheduled snapshot request`\n - **Label type** : `String`\n - **Field name** : `protoPayload.response.status`\n4. Click **Done**.\n\n5. Click **Create Metric**.\n\nCreate an alert policy\n----------------------\n\nAfter you create the metric, create an alert policy to send an alert when\nthere is a scheduled snapshot failure. \n\n### Console\n\n1. In the Google Cloud console, go to the\n **Cloud Logging \\\u003e Logs-based metrics** page.\n\n [Go to the Logs-based metrics page](https://console.cloud.google.com/logs/metrics)\n2. Under **User-defined Metrics** , find your new metric named\n `user/scheduled_snapshot_failure_count`.\n\n3. Click the more_vert **More**\n menu button in this row and select **Create alert from metric**. The\n alert policy condition creation page opens.\n\n4. In the **Target** panel, under **Aggregator** , select **none**.\n\n5. Under **Filter**:\n\n 1. Click **Add a filter**.\n 2. Select **status** from the list.\n 3. In the **Value** field, type DONE.\n 4. Click **Apply**.\n\n6. Click **Show advanced options**.\n\n7. In the **Advanced aggregation** pane, click the **Aligner** list and select\n **sum**.\n\n8. In the **Configuration** panel, select the following values:\n\n - **Condition triggers if** : `Any time series violates`\n - **Condition** : `is above`\n - **Threshold** : `1`\n - **For** : `most recent value`\n\n9. Click **Save**.\n\n10. On the **Create new alerting policy** page, enter a policy name.\n Optionally, you can add notification channels and documentation for\n this policy.\n\n11. Click **Save**.\n\nWhat's next\n-----------\n\n- Learn about snapshot schedule frequencies, retention policies, and naming rules in [About snapshot schedules for disks](/compute/docs/disks/about-snapshot-schedules).\n- Learn about [disk snapshots](/compute/docs/disks/snapshots).\n- Learn how to [create scheduled snapshots for disks](/compute/docs/disks/scheduled-snapshots).\n- Learn how to [view logs](/logging/docs/view/logs-explorer-interface)."]]