gcloud beta monitoring channels create
Stay organized with collections
Save and categorize content based on your preferences.
- NAME
-
- gcloud beta monitoring channels create - create a new notification channel
- SYNOPSIS
-
-
gcloud beta monitoring channels create[--channel-content=CHANNEL_CONTENT|--channel-content-from-file=PATH_TO_FILE] [--channel-labels=[KEY=VALUE,…]--description=DESCRIPTION--display-name=DISPLAY_NAME--no-enabled--type=TYPE--user-labels=[KEY=VALUE,…]] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
-
(BETA)Creates a new notification channel. A channel can be specified as JSON/YAML passed in as a string through the--channel-contentflag or as a file through the--channel-content-from-fileflag. A basic channel can also be specified through command line flags. If a channel is specified through--channel-contentor--channel-content-from-file, and additional flags are supplied, the flags will override the given channel's settings.For information about the JSON/YAML format of a notification channel: https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.notificationChannels
Additional documentation can for this operation can be found at: https://cloud.google.com/monitoring/alerts/using-channels-api
- EXAMPLES
-
The following commands setup both email and SMS notification channels for the
team lead. Note that the display name and description focus on the
purpose/semantics of the channel rather than its destination. This is a
best-practice that facilitates swapping/updating notification channels in-place
(such as when users change teams, projects, roles, companies, etc.) with minimal
impact to the alerting policies that reference the existing channels. It is also
a best practice to supply at least two channels of different types for a given
person.
gcloudbetamonitoringchannelscreate--display-name="Foo Team Lead (Primary)"--description="Primary contact method for the Foo team lead"--type=email--user-labels=team=foo,role=lead,ord=1--channel-labels=email_address=user@somedomain.tldgcloudbetamonitoringchannelscreate--display-name="Foo Team Lead (Secondary)"--description="Secondary contact method for the Foo team lead"--type=sms--user-labels=team=foo,role=lead,ord=2--channel-labels=number=123-456-7890 - FLAGS
-
-
At most one of these can be specified:
--channel-content=CHANNEL_CONTENT- The channel-content as a string. In either JSON or YAML format.
--channel-content-from-file=PATH_TO_FILE- The path to a JSON or YAML file containing the channel-content. Use a full or relative path to a local file containing the value of channel_content.
- Notification channel settings
--channel-labels=[KEY=VALUE,…]-
List of label KEY=VALUE pairs to add.
Keys must start with a lowercase character and contain only hyphens (
-), underscores (_), lowercase characters, and numbers.These are configuration fields that define the channel and its behavior.If the channel was given as a JSON/YAML object from a string or file, this flag will replace the labels value in the given channel.
--description=DESCRIPTION- An optional description for the channel.
--display-name=DISPLAY_NAME- The display name for the channel.
--enabled-
Whether notifications are forwarded to the described channel. Enabled by
default, use
--no-enabledto disable. --type=TYPE- The type of the notification channel. This field matches the value of the NotificationChannelDescriptor type field.
--user-labels=[KEY=VALUE,…]-
List of label KEY=VALUE pairs to add.
Keys must start with a lowercase character and contain only hyphens (
-), underscores (_), lowercase characters, and numbers. Values must contain only hyphens (-), underscores (_), lowercase characters, and numbers.If the channel was given as a JSON/YAML object from a string or file, this flag will replace the labels value in the given channel.
-
At most one of these can be specified:
- 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 helpfor details. - NOTES
-
This command is currently in beta and might change without notice. This variant
is also available:
gcloudalphamonitoringchannelscreate