File: //snap/google-cloud-cli/current/help/man/man1/gcloud_alpha_monitoring_snoozes_create.1
.TH "GCLOUD_ALPHA_MONITORING_SNOOZES_CREATE" 1
.SH "NAME"
.HP
gcloud alpha monitoring snoozes create \- create a new snooze
.SH "SYNOPSIS"
.HP
\f5gcloud alpha monitoring snoozes create\fR [\fB\-\-snooze\-from\-file\fR=\fIPATH_TO_FILE\fR] [\fB\-\-criteria\-filter\fR=\fICRITERIA_FILTER\fR\ \fB\-\-criteria\-policies\fR=\fICRITERIA_POLICIES\fR,[...]\ \fB\-\-display\-name\fR=\fIDISPLAY_NAME\fR\ \fB\-\-end\-time\fR=\fIEND_TIME\fR\ \fB\-\-start\-time\fR=\fISTART_TIME\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fB(ALPHA)\fR Creates a new snooze. A snooze can be specified as a JSON/YAML
value passed in as a file through the \f5\-\-snooze\-from\-file\fR flag. A
snooze can also be specified through command line flags. If a snooze is
specified through \f5\-\-snooze\-from\-file\fR, 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
.SH "EXAMPLES"
To create a snooze with command\-line options, run:
.RS 2m
$ gcloud alpha monitoring snoozes create \e
\-\-criteria\-policies=LIST_OF_POLICIES \-\-criteria\-filter=FILTER \e
\-\-display\-name=DISPLAY_NAME \-\-start\-time=START_TIME \e
\-\-end\-time=END_TIME
.RE
To create a snooze with a file, run:
.RS 2m
$ gcloud alpha monitoring snoozes create \-\-snooze\-from\-file=MY\-FILE
.RE
Sample contents of MY\-FILE:
.RS 2m
criteria:
policies:
\- projects/MY\-PROJECT/alertPolicies/MY\-POLICY
filter: 'resource.labels.zone="us\-central1\-a" AND resource.labels.instance_id="1234567890"'
interval:
startTime: '2024\-03\-01T08:00:00Z'
endTime: '2024\-03\-08T04:59:59.500Z'
displayName: New Snooze
.RE
.SH "FLAGS"
.RS 2m
.TP 2m
\fB\-\-snooze\-from\-file\fR=\fIPATH_TO_FILE\fR
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.
.TP 2m
Snooze Settings. If any of these are specified, they will overwrite fields in
the \f5\-\-snooze\-from\-file\fR flags if specified.
.RS 2m
.TP 2m
\fB\-\-criteria\-filter\fR=\fICRITERIA_FILTER\fR
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"
.TP 2m
\fB\-\-criteria\-policies\fR=\fICRITERIA_POLICIES\fR,[...]
The policies that the Snooze applies to. Exactly 1 alert policy is required if
\f5criteria\-filter\fR is specified at the same time.
.TP 2m
\fB\-\-display\-name\fR=\fIDISPLAY_NAME\fR
The display name for the Snooze.
.TP 2m
\fB\-\-end\-time\fR=\fIEND_TIME\fR
The start time for the Snooze.
.TP 2m
\fB\-\-start\-time\fR=\fISTART_TIME\fR
The start time for the Snooze.
.RE
.RE
.sp
.SH "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 \fB$ gcloud help\fR for details.
.SH "NOTES"
This command is currently in alpha and might change without notice. If this
command fails with API permission errors despite specifying the correct project,
you might be trying to access an API with an invitation\-only early access
allowlist. These variants are also available:
.RS 2m
$ gcloud monitoring snoozes create
.RE
.RS 2m
$ gcloud beta monitoring snoozes create
.RE