This document describes how to create and manage your snoozes. A snooze prevents Cloud Monitoring from creating incidents and issuing notifications during a specific time period. Each snooze specifies the resources to which it applies.
For a conceptual overview, see Snooze notifications and incidents .
To create and manage your snoozes, you use the Google Cloud console or the Cloud Monitoring API.
This feature is supported only for Google Cloud projects. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
Before you begin
Complete the following in the Google Cloud project that stores your alerting policy:
-
Ensure that you have the required permissions:
-
To get the permissions that you need to view and edit snoozes 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 .
-
To get the permissions that you need to view and edit snoozes by using the Cloud Monitoring API , ask your administrator to grant you the Monitoring Snooze Editor (
roles/monitoring.snoozeEditor
) 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 .
-
-
If you want to use the Cloud Monitoring API examples in this document, then do the following:
-
Create an environment variable,
PROJECT_ID
, to hold the ID of your Google Cloud project:PROJECT_ID= PROJECT_ID
-
Authenticate to Google Cloud CLI:
gcloud auth login
-
Set the default Google Cloud project:
gcloud config set project ${ PROJECT_ID }
-
Create an authorization token:
ACCESS_TOKEN=`gcloud auth print-access-token`
You have to periodically refresh the access token. If commands that worked suddenly report that you're unauthenticated, re-issue this command.
-
Create a snooze
To prevent alerting policies from creating incidents and sending notifications, create a snooze. When you restrict a snooze to one alerting policy, the snooze can include label-based filters . If you add label-based filters, then the snooze applies only to those incidents that match the filters. After you create a snooze, you can't modify the label-based filter or list of policies the snooze applies to.
console
The Google Cloud console provides two ways to create a snooze:
-
If you start from the Incident details page of an open incident, the dialog you complete to create the snooze is preconfigured to list your alerting policy. The dialog also lets you select labels, which are attached to the snooze as label-based filters.
-
If you start from the Alertingpage, you can create a snooze whose criteria lists up to 16 alerting policies. However, you can't attach label-based filters to your snooze even when the snooze criteria lists one alerting policy.
To create a snooze from an open incident, do the following:
-
In the Google Cloud console, go to the notifications Alerting page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring .
- In the toolbar of the Google Cloud console, select your Google Cloud project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
- In the Incidents pane of the Alertingpage, find your incident and click Incident summary .
- On the Incident details page, click Snooze, and then select the snooze duration.
-
Optional: To add a label-based filter to your snooze, go to the Labelssection and select one or more labels. A label-based filter can include resource and metric labels. When the alerting policy isn't PromQL-based, the filter can also include metadata labels.
Normally, snoozes apply to all incidents created by an alerting policy. Filters let you apply the snooze to incidents whose labels match the labels in the filter.
-
Click Snooze. The snooze now applies to the alerting policy that created the incident.
To create a snooze from the Alertingpage, do the following:
-
In the Google Cloud console, go to the notifications Alerting page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring .
- In the toolbar of the Google Cloud console, select your Google Cloud project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
- On the Alertingpage, click Create snooze.
- Enter a descriptive name for the snooze. This name is shown on the Alertingpage.
- Select a Start time. You can enter a specific time or you can start the snooze when the snooze is created.
- Enter the Duration. The value of this field determines how long the snooze lasts.
-
Complete the Snooze criteriasection. You can use the Alert policiesmenu to select the alerting policies to which the snooze applies.
You can add up to 16 alerting policies to a snooze.
After a snooze is created, its criteria can't be modified.
After you complete the Snooze criteriasection, the Create snoozepane lists past incidents that match the criteria.
-
Click Create.
Cloud Monitoring API
The Cloud Monitoring API lets you create a snooze whose criteria lists up to 16 alerting policies. If the snooze applies to one alerting policy, then you can also include label-based filters.
To create a snooze, invoke the snoozes.create
method by issuing a POST
request to the Snooze
endpoint.
You must supply a snooze
object:
curl -d @my-snooze.json -H "Authorization: Bearer $ACCESS_TOKEN" \ -H 'Content-Type: application/json' \ -X POST https://monitoring.googleapis.com/v3/projects/${PROJECT_ID}/snoozes
In the previous expression, PROJECT_ID
is an environment variable that
stores your project ID. For App Hub
configurations, select the App Hub host project or
the app-enabled folder's management project.
The method returns a snooze
object. The "name"
field,
which includes the snooze ID that is generated by Monitoring,
is the only difference between the returned object and the
contents of my-snooze.json
:
{
"name"
:
"projects/my-project/snoozes/778899"
,
"criteria"
:
{
"policies"
:
[
"projects/my-project/alertPolicies/001122"
]
},
"interval"
:
{
"startTime"
:
"2022-11-12T19:00:20Z"
,
"endTime"
:
"2022-11-12T19:05:20Z"
},
"displayName"
:
"Snooze2"
}
gcloud CLI
The gcloud CLI lets you create a snooze whose criteria lists up to 16 alerting policies. If the snooze applies to one alerting policy, then you can also include label-based filters.
To create a snooze, run the gcloud monitoring snoozes create
command:
gcloud monitoring snoozes create -- criteria - policies = LIST_OF_POLICIES -- display - name = DISPLAY_NAME -- start - time = START_TIME -- end - time = END_TIME -- project = PROJECT_ID -- criteria - filter = FILTER
Before you run the previous command, replace the following:
- LIST_OF_POLICIES : The policies to which the snooze applies. If you specify multiple projects, then separate the projects by a comma.
- PROJECT_ID : The identifier of the project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
- DISPLAY_NAME : The name to display in the Google Cloud console.
- START_TIME : The start time.
-
END_TIME : The end time. The value must be at least one minute later than the start time.
For the start and end times, you must follow the ISO 8601 formatting rules. However, you can specify absolute or relative times. The following example specifies absolute times. To start a snooze 30 minutes from the current time, use
--start-time="+PTM30M"
. -
FILTER : Optional. A label-based filter can be defined when the snooze applies to one alerting policy. The filter, which can include resource, metric, and metadata labels, applies the snooze to incidents with matching labels. When the alerting policy is PromQL-based, the filter can't use metadata labels. For more information, see the
gcloud monitoring snoozes create
reference page.
For example, the following command creates a snooze for an alerting policy with an ID of "12345". The time span of the snooze is the interval from March 1, 2025 through March 7, 2025.
gcloud monitoring snoozes create --display-name="Maintenance Week" \
--criteria-policies="projects/my-project/alertPolicies/12345" \
--start-time="2025-03-01T03:00:00.0-0500" \
--end-time="2025-03-07T23:59:59.5-0500" \
--project= PROJECT_ID
The previous example creates the following snooze in my-project
:
{
"name"
:
"projects/my-project/snoozes/778899"
,
"criteria"
:
{
"policies"
:
[
"projects/my-project/alertPolicies/12345"
]
},
"interval"
:
{
"startTime"
:
"2025-03-01T03:00:00.0-0500"
,
"endTime"
:
"2025-03-07T23:59:59.5-0500"
},
"displayName"
:
"Maintenance Week"
}
If successful, the response to this command is similar to the following:
Created snooze [projects/my-project/snoozes/778899]
The name of an alerting policy isn't displayed in the Google Cloud console. To determine the name of an alerting policy, do one of the following:
- Run the
gcloud alpha monitoring policies list
command. The response data of this command includes the name of your alerting policies. - View the JSON representation of an alerting policy. You can download the JSON representation to your local system by using an option on the Policy detailspage.
Create recurring snoozes
To create snoozes that happen over recurring intervals, you can write a script
that creates a snooze for an alerting policy. Then, use a job scheduler such as cron
or Cloud Scheduler
to run the script on your required
schedule.
List snoozes
When you create a snooze, it's added to the historical record of snoozes for your project. This record shows the expired, active, and upcoming snoozes. You can't remove entries from this record, that is, you can't delete a snooze. However, from this view, you can display the details about a snooze and you can perform actions like editing or copying the snooze.
console
To view a list of snoozes, do the following:
-
In the Google Cloud console, go to the notifications Alerting page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring .
- In the toolbar of the Google Cloud console, select your Google Cloud project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
-
Click See all snoozes in the Snooze pane.
The Snoozepage displays a list of snoozes and a timeline that graphically displays your past, upcoming, and active snoozes.
- To edit, copy, cancel, or end a snooze, use the more_vert More optionsmenu for the snooze. The snooze state determines which options are available.
- To list all snoozes, enable Show past snoozes. By default, only active and upcoming snoozes are listed.
- To change the display period for the Timelinetable, use the Time rangemenu. By default, the table shows data for the next hour; however, you can modify this field to specify past or future time ranges. Expired snoozes are retained for 13 months.
- To view details about a specific snooze, click View details.
- To view a summary of active snoozes, place your pointer on the shaded area of the Activerow in the Timelinetable. The tooltip displays the summary information.
- To view a graphical representation of active snoozes, expand the Activerow of the Timelinetable.
Cloud Monitoring API
To list all snoozes that belong to a Google Cloud project, invoke the snoozes.list
method:
curl -H "Authorization: Bearer $ACCESS_TOKEN" \ https://monitoring.googleapis.com/v3/projects/${PROJECT_ID}/snoozes
In the previous expression, PROJECT_ID
is an environment variable that
stores your project ID. For App Hub
configurations, select the App Hub host project or
the app-enabled folder's management project.
The method returns a list of snooze
objects. For example,
when a project has one snooze, the response to the snoozes.list
command
is similar to the following:
{
"name"
:
"projects/my-project/snoozes/778899"
,
"criteria"
:
{
"policies"
:
[
"projects/my-project/alertPolicies/12345"
]
},
"interval"
:
{
"startTime"
:
"2025-03-01T03:00:00.0-0500"
,
"endTime"
:
"2025-03-07T23:59:59.5-0500"
},
"displayName"
:
"Snooze2"
}
To get information about a specific snooze, invoke the snoozes.get
method
and specify the project ID and the snooze ID. In the previous response,
the snooze ID is 2986663705844383744
:
curl -H "Authorization: Bearer $ACCESS_TOKEN" \ https://monitoring.googleapis.com/v3/projects/${PROJECT_ID}/snoozes/${SNOOZE_ID}
The method returns a single snooze
object:
{
"name"
:
"projects/my-project/snoozes/778899"
,
"criteria"
:
{
"policies"
:
[
"projects/my-project/alertPolicies/12345"
]
},
"interval"
:
{
"startTime"
:
"2025-03-01T03:00:00.0-0500"
,
"endTime"
:
"2025-03-07T23:59:59.5-0500"
},
"displayName"
:
"Snooze2"
}
gcloud CLI
To list the snoozes in your current project, run the gcloud monitoring snoozes list
command:
gcloud monitoring snoozes list --project= PROJECT_ID
OPTIONAL_FLAGS
Before you run the previous command, replace the following:
- PROJECT_ID : The identifier of the project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
- OPTIONAL_FLAGS
: For information about the optional flags, see the
gcloud monitoring snoozes list
reference page.
The response to this command is a list of names of snoozes in the project,
formatted as YAML. For example, the response to this command for the
Google Cloud project with ID my-project
is a single entry:
criteria: policies: - projects/my-project/alertPolicies/12345 - projects/my-project/alertPolicies/23451 displayName: Maintenance Week interval: endTime: '2023-03-08T04:59:59Z' startTime: '2023-03-01T08:00:00Z' name: projects/my-project/snoozes/778899
To list details about a specific snooze, run the gcloud monitoring snoozes describe
command:
gcloud monitoring snoozes describe NAME --project= PROJECT_ID
For example, to display the details about the snooze with name projects/my-project/snoozes/778899
, run the following command:
gcloud monitoring snoozes describe projects/my-project/snoozes/778899 --project= PROJECT_ID
If you provide an invalid NAME
to a describe
command, then the
response contains an error code of 500
and the following message:
Internal error encountered. Please retry after a few seconds. If internal errors persist, contact support at https://cloud.google.com/support/docs.
Edit a snooze
You can edit the name and period of an upcoming snooze, and you can edit the name and end time of an active snooze. For example, when a maintenance window is rescheduled, you might need to edit a snooze.
You can't edit a past snooze, the criteria of any snooze, or the label-based filters attached to a snooze.
If you want to schedule a past snooze for a future time period, then copy the snooze and apply changes to the copy before you select Create.
console
To edit a snooze, do the following:
-
In the Google Cloud console, go to the notifications Alerting page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring .
- In the toolbar of the Google Cloud console, select your Google Cloud project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
- Click See all snoozes in the Snooze pane.
- In the list of snoozes, find the snooze that you want to edit, and then select Edit snoozein the more_vert More optionsmenu.
- Click Saveafter you complete your changes.
Cloud Monitoring API
To modify an existing snooze, invoke the snoozes.patch
method by issuing a PATCH
request to the Snooze
endpoint.
You must supply the revised snooze
object and include
query parameters that identify which fields are modified. When using curl,
query parameters must be URL-encoded.
For upcoming snoozes, you can modify the name and the period. For active snoozes, you can modify the name and the end time. You can't modify past snoozes.
To update the displayName
of a snooze, create a JSON file, my-updated-snooze.json
, which describes the snooze object and updates the
display name. Then, run the following command:
curl -d @my-updated-snooze.json -H "Authorization: Bearer $ACCESS_TOKEN" \ -H 'Content-Type: application/json' \ -X PATCH https://monitoring.googleapis.com/v3/projects/${PROJECT_ID}/snoozes/${SNOOZE_ID}?updateMask=displayName
In the previous expression:
-
PROJECT_ID
is an environment variable that stores the ID of your project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project. -
SNOOZE_ID
is an environment variable that stores the ID of the snooze.
The method returns a snooze
object which is identical to the
contents of the file my-updated-snooze.json
:
{
"name"
:
"projects/my-project/snoozes/778899"
,
"criteria"
:
{
"policies"
:
[
"projects/my-project/alertPolicies/12345"
]
},
"interval"
:
{
"startTime"
:
"2025-03-01T03:00:00.0-0500"
,
"endTime"
:
"2025-03-07T23:59:59.5-0500"
},
"displayName"
:
"Snooze2"
}
gcloud CLI
To edit a snooze, run the gcloud monitoring snoozes update
command. You can update
the display name, the start time, and the end time:
gcloud monitoring snoozes update NAME --project= PROJECT_ID OPTIONAL_FLAGS
Before you run the previous command, replace the following:
- NAME : The name of the snooze.
- PROJECT_ID : The identifier of the project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
- OPTIONAL_FLAGS
: For information about the optional flags, see the
gcloud monitoring snoozes update
reference page.
For example, to change the display name of the snooze with the name projects/my-project/snoozes/778899
, run the following command:
gcloud monitoring snoozes update projects/my-project/snoozes/778899 --display-name="Maintenance Week" --project= PROJECT_ID
End or cancel a snooze
If you want to receive notifications for resources that match the criteria specified in an active snooze, then end the snooze. For example, when planned maintenance completes more quickly than anticipated, you might want to end a snooze.
If you have an upcoming snooze that you no longer want, then cancel the snooze. The cancel operation sets the duration to zero and results in the snooze transitioning to the Paststate.
console
To end an active snooze or to cancel an upcoming snooze, do the following:
-
In the Google Cloud console, go to the notifications Alerting page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring .
- In the toolbar of the Google Cloud console, select your Google Cloud project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
- Click See all snoozes in the Snooze pane.
-
In the list of snoozes, find the snooze that you want to end or cancel, and then do one of the following:
- To end an active snooze, select End nowin the more_vert More optionsmenu.
- To cancel an upcoming snooze, select Cancel snoozein the more_vert More optionsmenu.
Cloud Monitoring API
To end an active snooze, edit the snooze and set the end time to the current time. For more information, see Edit a snooze .
To cancel an upcoming snooze, edit the snooze and set the end time to the snooze start time. The start time must be in the future. For more information, see Edit a snooze .
gcloud CLI
To end an active snooze or to cancel an upcoming snooze, run the gcloud monitoring snoozes cancel
command:
gcloud monitoring snoozes cancel NAME --project= PROJECT_ID
Before you run the previous command, replace the following:
- NAME : The name of the snooze.
- PROJECT_ID : The identifier of the project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
For example, to cancel the snooze with the name projects/my-project/snoozes/778899
, run the following command:
gcloud monitoring snoozes cancel projects/my-project/snoozes/778899 --project= PROJECT_ID
Copy a snooze
When you want to use an existing snooze as a template for another snooze, make a copy. When you copy a snooze, the snooze editor opens with all fields except for the start time set to the values in the original snooze. You can modify all fields before you click Create.
To copy a snooze by using the console, do the following:
-
In the Google Cloud console, go to the notifications Alerting page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring .
- In the toolbar of the Google Cloud console, select your Google Cloud project. For App Hub configurations, select the App Hub host project or the app-enabled folder's management project.
- Click See all snoozes in the Snooze pane.
- In the list of snoozes, find the snooze that you want to edit, and then select Copy snoozein the more_vert More optionsmenu.
- Apply your modifications to the copy and then click Create.
What's next
-
For an overview of alerting, see Alerting overview .
-
For information about notification latency and how the choices for the parameters of an alerting policy affect when notifications are sent, see Behavior of metric-based alerting policies .
-
For information about incidents, see the following documents: