Docs Menu

Docs HomeLaunch & Manage MongoDBMongoDB CLI

mongocli cloud-manager alerts settings create

On this page

  • Syntax
  • Options
  • Inherited Options
  • Output
  • Examples

Create an alert configuration for your project.

To use this command, you must authenticate with a user account or an API key with the Project Owner role.

Command Syntax
mongocli cloud-manager alerts settings create [options]
Name
Type
Required
Description
--apiKey
string
false
Datadog API Key, Opsgenie API Key, or VictorOps API key. Required if the notificationType is DATADOG, OPS_GENIE, or VICTOR_OPS, respectively.
--enabled
false
Flag that indicates whether to enable the alert configuration.
--event
string
false
Type of event that triggered the alert. To learn which values the CLI accepts, see the possible eventTypeName values in the API documentation for Atlas (https://dochub.mongodb.org/core/atlas-event-names), Ops Manager (https://dochub.mongodb.org/core/om-event-names), or Cloud Manager (https://dochub.mongodb.org/core/cm-event-names).
-h, --help
false
help for create
--matcherFieldName
string
false
Name of the field in the target object to match on. To learn the valid values, run mongocli atlas alerts settings fields type.
--matcherOperator
string
false
Comparison operator to apply when checking the current metric against matcherValue. Valid values are CONTAINS, ENDS_WITH, EQUALS, NOT_CONTAINS, NOT_EQUALS, REGEX, STARTS_WITH.
--matcherValue
string
false
Value to test with the specified operator. If matcherFieldName is set to TYPE_NAME, you can match on the following values: CONFIG, MONGOS, PRIMARY, SECONDARY, STANDALONE.
--metricMode
string
false
Option that indicates whether Atlas computes the current metric value as an average. Valid value is AVERAGE.
--metricName
string
false
Name of the metric against which this command checks the configured alert. To learn the valid values, see https://dochub.mongodb.org/core/alert-host-metrics-atlas. This option applies only if the event is set to OUTSIDE_METRIC_THRESHOLD.
--metricOperator
string
false
Comparison operator to apply when checking the current metric value. Valid values are LESS_THAN and GREATER_THAN.
--metricThreshold
float
false
Threshold value outside of which an alert will be triggered.
--metricUnits
string
false
Units for the threshold value. Valid values are BITS, BYTES, DAYS, GIGABITS, GIGABYTES, HOURS, KILOBITS, KILOBYTES, MEGABITS, MEGABYTES, MILLISECONDS, MINUTES, PETABYTES, RAW, SECONDS, TERABYTES.
--notificationChannelName
string
false
Slack channel name. Required for the SLACK notifications type.
--notificationDelayMin
int
false
Number of minutes to wait after an alert condition is detected before sending out the first notification.
--notificationEmailAddress
string
false
Email address to which alert notifications are sent.
--notificationEmailEnabled
false
Flag that enables email notifications. Configurable for GROUP and USER notification types.
--notificationIntervalMin
int
false
Number of minutes to wait between successive notifications for unacknowledged alerts that are not resolved.
--notificationMobileNumber
string
false
Mobile number to which alert notifications are sent.
--notificationRegion
string
false
Region that indicates which API URL to use.
--notificationServiceKey
string
false
PagerDuty service key.
--notificationSmsEnabled
false
Flag that enables text message notifications.
--notificationTeamId
string
false
Unique identifier of a team.
--notificationToken
string
false
Slack API token, or Bot token.
--notificationType
string
false
Type of alert notification. Valid values are DATADOG, EMAIL, GROUP (Project), ORG, OPS_GENIE, PAGER_DUTY, SLACK, SMS, USER, or VICTOR_OPS.
--notificationUsername
string
false
Name of the Atlas user to which to send notifications.
--notificationVictorOpsRoutingKey
string
false
Routing key associated with your Splunk On-Call account.
-o, --output
string
false
Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option.
--projectId
string
false
Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.
Name
Type
Required
Description
-P, --profile
string
false
Name of the profile to use from your configuration file. To learn about profiles for MongoCLI, see https://dochub.mongodb.org/core/atlas-cli-configuration-file.

If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values.

Alert configuration <ID> created.
# Create an alert configuration that notifies a user when they join a group for the project with the ID 5df90590f10fab5e33de2305:
mongocli atlas alerts settings create --event JOINED_GROUP --enabled \
--notificationType USER --notificationEmailEnabled \
--notificationUsername john@example.com \
--output json --projectId 5df90590f10fab5e33de2305
←  mongocli cloud-manager alerts settingsmongocli cloud-manager alerts settings delete →