2023-05-04 10:43:54 +00:00
|
|
|
NAME
|
|
|
|
|
gcloud monitoring snoozes create - create a new snooze
|
|
|
|
|
|
|
|
|
|
SYNOPSIS
|
2024-07-31 09:35:16 +00:00
|
|
|
gcloud monitoring snoozes create [--snooze-from-file=PATH_TO_FILE]
|
2025-02-12 10:41:39 +00:00
|
|
|
[--criteria-filter=CRITERIA_FILTER
|
|
|
|
|
--criteria-policies=CRITERIA_POLICIES,[...]
|
2023-05-04 10:43:54 +00:00
|
|
|
--display-name=DISPLAY_NAME
|
|
|
|
|
--end-time=END_TIME --start-time=START_TIME] [GCLOUD_WIDE_FLAG ...]
|
|
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
Creates a new snooze. A snooze can be specified as a JSON/YAML value passed
|
|
|
|
|
in as a file through the --snooze-from-file flag. A snooze can also be
|
|
|
|
|
specified through command line flags. If a snooze is specified through
|
|
|
|
|
--snooze-from-file, and additional flags are supplied, the flags will
|
|
|
|
|
override the snooze's settings.
|
|
|
|
|
|
|
|
|
|
For information about the JSON/YAML format of a snooze:
|
|
|
|
|
https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.snoozes
|
|
|
|
|
|
|
|
|
|
EXAMPLES
|
|
|
|
|
To create a snooze with command-line options, run:
|
|
|
|
|
|
|
|
|
|
$ gcloud monitoring snoozes create \
|
2025-02-12 10:41:39 +00:00
|
|
|
--criteria-policies=LIST_OF_POLICIES --criteria-filter=FILTER \
|
2023-05-04 10:43:54 +00:00
|
|
|
--display-name=DISPLAY_NAME --start-time=START_TIME \
|
|
|
|
|
--end-time=END_TIME
|
|
|
|
|
|
|
|
|
|
To create a snooze with a file, run:
|
|
|
|
|
|
|
|
|
|
$ gcloud monitoring snoozes create --snooze-from-file=MY-FILE
|
|
|
|
|
|
|
|
|
|
Sample contents of MY-FILE:
|
|
|
|
|
|
|
|
|
|
criteria:
|
|
|
|
|
policies:
|
|
|
|
|
- projects/MY-PROJECT/alertPolicies/MY-POLICY
|
2025-02-12 10:41:39 +00:00
|
|
|
filter: 'resource.labels.zone="us-central1-a" AND resource.labels.instance_id="1234567890"'
|
2023-05-04 10:43:54 +00:00
|
|
|
interval:
|
|
|
|
|
startTime: '2024-03-01T08:00:00Z'
|
|
|
|
|
endTime: '2024-03-08T04:59:59.500Z'
|
|
|
|
|
displayName: New Snooze
|
|
|
|
|
|
|
|
|
|
FLAGS
|
2024-07-31 09:35:16 +00:00
|
|
|
--snooze-from-file=PATH_TO_FILE
|
|
|
|
|
The path to a JSON or YAML file containing the snooze. Use a full or
|
|
|
|
|
relative path to a local file containing the value of snooze.
|
2023-05-04 10:43:54 +00:00
|
|
|
|
|
|
|
|
Snooze Settings. If any of these are specified, they will overwrite fields
|
|
|
|
|
in the --snooze-from-file flags if specified.
|
|
|
|
|
|
2026-02-11 11:28:25 +00:00
|
|
|
--criteria-filter=CRITERIA_FILTER
|
|
|
|
|
Optional. When you define a Snooze, you can also define a filter for
|
|
|
|
|
that snooze. The filter is a string containing one or more key-value
|
|
|
|
|
pairs. The string uses the standard https://google.aip.dev/160 filter
|
|
|
|
|
syntax. If you define a filter for a snooze, then the snooze can only
|
|
|
|
|
apply to one alert policy. When the snooze is active, incidents won't
|
|
|
|
|
be created when the incident would have key-value pairs (labels) that
|
|
|
|
|
match those specified by the filter in the snooze. Snooze filters
|
|
|
|
|
support resource, metric, and metadata labels. If multiple labels are
|
|
|
|
|
used, then they must be connected with an AND operator. For example:
|
|
|
|
|
resource.labels.instance_id="1234567890" AND
|
|
|
|
|
resource.labels.zone="us-central1-a" AND
|
|
|
|
|
metric.labels.instance_name="test_group" AND
|
|
|
|
|
metadata.user_labels.foo="bar" AND
|
|
|
|
|
metadata.system_labels.region="us-central1"
|
|
|
|
|
|
|
|
|
|
--criteria-policies=CRITERIA_POLICIES,[...]
|
|
|
|
|
The policies that the Snooze applies to. Exactly 1 alert policy is
|
|
|
|
|
required if criteria-filter is specified at the same time.
|
|
|
|
|
|
|
|
|
|
--display-name=DISPLAY_NAME
|
|
|
|
|
The display name for the Snooze.
|
|
|
|
|
|
|
|
|
|
--end-time=END_TIME
|
|
|
|
|
The end time for the Snooze.
|
|
|
|
|
|
|
|
|
|
--start-time=START_TIME
|
|
|
|
|
The start time for the Snooze.
|
2023-05-04 10:43:54 +00:00
|
|
|
|
|
|
|
|
GCLOUD WIDE FLAGS
|
|
|
|
|
These flags are available to all commands: --access-token-file, --account,
|
|
|
|
|
--billing-project, --configuration, --flags-file, --flatten, --format,
|
|
|
|
|
--help, --impersonate-service-account, --log-http, --project, --quiet,
|
|
|
|
|
--trace-token, --user-output-enabled, --verbosity.
|
|
|
|
|
|
|
|
|
|
Run $ gcloud help for details.
|
|
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
These variants are also available:
|
|
|
|
|
|
|
|
|
|
$ gcloud alpha monitoring snoozes create
|
|
|
|
|
|
|
|
|
|
$ gcloud beta monitoring snoozes create
|
|
|
|
|
|