Navigation

Create One Alert Configuration

Info With Circle IconCreated with Sketch.Note

Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project ID. For existing groups, your group/project ID remains the same. The resource and corresponding endpoints use the term groups.

Base URL: https://cloud.mongodb.com/api/atlas/v1.0

POST /groups/{PROJECT-ID}/alertConfigs
ParameterTypeNecessityDescription
PROJECT-IDstringRequiredUnique identifier for the Project.

This endpoint may use any of the HTTP request query parameters available to all Atlas API resources. These are all optional.

NameTypeNecessityDescriptionDefault
pageNumintegerOptionalPage number, starting with one, that Atlas returns of the total number of objects.1
itemsPerPageintegerOptionalNumber of items that Atlas returns per page, up to a maximum of 500.100
includeCountbooleanOptionalFlag that indicates whether Atlas returns the totalCount parameter in the response body.true
prettybooleanOptionalFlag that indicates whether Atlas returns the JSON response in the prettyprint format.false
envelopebooleanOptional

Flag that indicates whether Atlas wraps the response in an envelope.

Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query.

Endpoints that return a list of results use the results object as an envelope. Atlas adds the status parameter to the response body.

false

Alert configurations depend why you want Atlas to raise an alert. Alerts can be triggered if either:

  • a particular condition is met or
  • a particular metric exceeded a particular value.

To simplify the differences between condition and metrics, click one of the following tabs:

NameTypeNecessityDescription
enabledbooleanOptionalFlag that indicates if this alert configuration is enabled or disabled.
eventTypeNamestringRequired

Type of event that triggers an alert.

Alert TargetCondition
Backup
CPS_SNAPSHOT_SUCCESSFUL
Snapshot taken successfully
CPS_SNAPSHOT_FALLBACK_SUCCESSFUL
Fallback snapshot taken
CPS_SNAPSHOT_FALLBACK_FAILED
Fallback snapshot failed
CPS_SNAPSHOT_BEHIND
Snapshot schedule fell behind
CPS_RESTORE_FAILED
Backup restore failed
CPS_RESTORE_SUCCESSFUL
Backup restore succeeded
CPS_SNAPSHOT_DOWNLOAD_REQUEST_FAILED
Snapshot download request failed
Billing
CREDIT_CARD_ABOUT_TO_EXPIRE
Credit card is about to expire
PENDING_INVOICE_OVER_THRESHOLD
Monthly pending invoice ($) total is...
DAILY_BILL_OVER_THRESHOLD
Daily amount billed ($) is...
Encryption Key
AWS_ENCRYPTION_KEY_NEEDS_ROTATION
AWS encryption key elapsed time since last rotation is...
AZURE_ENCRYPTION_KEY_NEEDS_ROTATION
Azure encryption key elapsed time since last rotation is...
GCP_ENCRYPTION_KEY_NEEDS_ROTATION
GCP encryption key elapsed time since last rotation is...
Host
HOST_DOWN
Host is down
OUTSIDE_METRIC_THRESHOLD
Metric occurred outside of the metric threshold. See View Cluster Metrics.
Project
USERS_WITHOUT_MULTIFACTOR_AUTH
Users do not have two-factor authentication enabled
Replica Set
PRIMARY_ELECTED
Replica set elected a new primary
NO_PRIMARY
Replica set has no primary
TOO_MANY_ELECTIONS
Number of election events is...
REPLICATION_OPLOG_WINDOW_RUNNING_OUT
Replication Oplog Window is...
Sharded Cluster
CLUSTER_MONGOS_IS_MISSING
Cluster is missing an active mongos
User
USER_ROLES_CHANGED_AUDIT
User had their role changed
JOINED_GROUP
User joined the project
REMOVED_FROM_GROUP
User left the project
USER_ROLES_CHANGED_AUDIT
User had their role changed
X.509
NDS_X509_USER_AUTHENTICATION_MANAGED_USER_CERTS_EXPIRATION_CHECK
X.509 User Authentication, Client Certificates Expiration Alert when days to expiration is...
NDS_X509_USER_AUTHENTICATION_CUSTOMER_CA_EXPIRATION_CHECK
X.509 User Authentication, Self-Managed CA Expiration Alert when days to expiration is...
matchersarray of objectsRequired

Rules to apply when matching an object against this alert configuration. Only entities that match all these rules are checked for an alert condition.

Atlas limits filtering alerts using matchers when the eventTypeName specifies an event for the following:

  • a host,
  • a replica set, or
  • a sharded cluster.

To add one or more matchers, see Filter Results.

notificationsarray of objectsRequired

One or more targets for Atlas to send notifications when an alert condition is detected. You can configure any number of notifications for each alert condition.

To add one or more notifications, see Set Notifications.

thresholdobjectConditional

Threshold that triggers an alert. Don't include if "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD".

To add one threshold, see Trigger Alerts.

threshold
.operator
stringRequired

Comparison operator to apply when checking the current condition against the threshold.threshold value. Atlas accepts the following values:

  • GREATER_THAN
  • LESS_THAN
threshold
.threshold
integerRequiredValue that, when exceeded, Atlas triggers an alert.
threshold.unitsstringRequiredUnits of capacity or time that define the scope of the threshold.threshold.
matchers
.[n].fieldName
stringRequired

Name of the field in the target object that you wanted this configuration to match. Atlas accepts the following values:

HostReplica setSharded cluster
TYPE_NAME
HOSTNAME
PORT
HOSTNAME_AND_PORT
REPLICA_SET_NAME
REPLICA_SET_NAME
SHARD_NAME
CLUSTER_NAME
CLUSTER_NAME
SHARD_NAME
matchers
.[n].operator
stringOptional

Comparison operator to apply when checking the current metric value against matcher.[n].value. Atlas accepts the following values:

  • EQUALS
  • NOT_EQUALS
  • CONTAINS
  • NOT_CONTAINS
  • STARTS_WITH
  • ENDS_WITH
  • REGEX
matchers
.[n].value
stringOptional

Value against which the specified operator compares.

If you set matchers.[n].fieldName to TYPE_NAME, you can match on the following values:

  • PRIMARY
  • SECONDARY
  • STANDALONE
  • CONFIG
  • MONGOS
notifications.[n]
.apiToken
stringConditional

Slack API token.

If the token later becomes invalid, Atlas sends an email to the Project Owner and eventually removes the token.

Set this value if you set notifications.[n].typeName to SLACK.

notifications.[n]
.channelName
stringConditional

Slack channel name.

Set this value if you set notifications.[n].typeName to SLACK.

notifications.[n]
.datadogApiKey
stringConditional

Datadog API Key. Found in the Datadog dashboard.

Set this value if you set notifications.[n].typeName to DATADOG.

notifications.[n]
.datadogRegion
stringConditional

Region that indicates which API URL to use. Atlas accepts the following values:

  • US
  • EU

The default Datadog region is US.

Set this value if you set notifications.[n].typeName to DATADOG.

notifications.[n]
.delayMin
integerConditionalNumber of minutes to wait after an alert condition is detected before sending out the first notification.
notifications.[n]
.emailAddress
stringConditional

Email address to which alert notifications are sent.

Set this value if you set notifications.[n].typeName to EMAIL.

You don't need to set this value to send emails to specific users, users with specific project roles, users with specific organization roles, or teams. Use the notifications.[n].emailEnabled parameter for that purpose.

notifications.[n]
.emailEnabled
booleanConditional

Flag indicating if email notifications should be sent to this user's email address.

Set this value if you set notifications.[n].typeName to GROUP, ORG, or USER.

notifications.[n]
.flowdockApiToken
stringConditional

Flowdock personal API token.

If the token later becomes invalid, Atlas sends an email to the Project Owner and eventually removes the token.

Set this value if you set notifications.[n].typeName to FLOWDOCK.

notifications.[n]
.flowName
stringConditional

Flowdock flow name in lower-case letters. The flow name appears after the organization name in the URL string:

www.flowdock.com/app/<organization-name>/<flow-name>.

Set this value if you set notifications.[n].typeName to FLOWDOCK.

notifications.[n]
.intervalMin
integerRequiredNumber of minutes to wait between successive notifications for unacknowledged alerts that are not resolved. The minimum value is 5.
notifications.[n]
.mobileNumber
stringConditional

Mobile number to which alert notifications are sent.

Set this value if you set notifications.[n].typeName to SMS.

You don't need to set this value to send emails to specific users, users with specific project roles, users with specific organization roles, or teams. Use the notifications.[n].smsEnabled parameter for that purpose.

notifications.[n]
.notificationToken
stringConditional

HipChat API token.

Set this value if you set notifications.[n].typeName to HIP_CHAT.

If the token later becomes invalid, Atlas sends an email to the Project owner and eventually removes the token.

notifications.[n]
.opsGenieApiKey
stringConditional

Opsgenie API Key.

If the key later becomes invalid, Atlas sends an email to the Project Owner and eventually removes the key.

Set this value if you set notifications.[n].typeName to OPS_GENIE.

notifications.[n]
.opsGenieRegion
stringConditional

Region that indicates which API URL to use. Atlas accepts the following values:

  • US
  • EU

The default Opsgenie region is US.

Set this value if you set notifications.[n].typeName to OPS_GENIE.

notifications.[n]
.orgName
stringConditional

Flowdock organization name in lower-case letters. This is the name that appears after www.flowdock.com/app/ in the URL string.

Set this value if you set notifications.[n].typeName to FLOWDOCK.

notifications.[n]
.roles
array of stringsConditional

One or more roles that receive the configured alert. Atlas accepts the following values:

Project rolesOrganization roles
  • GROUP_CLUSTER_MANAGER
  • GROUP_DATA_ACCESS_ADMIN
  • GROUP_DATA_ACCESS_READ_ONLY
  • GROUP_DATA_ACCESS_READ_WRITE
  • GROUP_OWNER
  • GROUP_READ_ONLY
  • ORG_OWNER
  • ORG_MEMBER
  • ORG_GROUP_CREATOR
  • ORG_BILLING_ADMIN
  • ORG_READ_ONLY

If you include this field, Atlas sends alerts only to users assigned the roles you specify in the array. If you omit this field, Atlas sends alerts to users assigned any role.

Set this value if you set notifications.[n].typeName to GROUP or ORG.

notifications.[n]
.roomName
stringConditional

HipChat room name.

Set this value if you set notifications.[n].typeName to HIP_CHAT.

notifications.[n]
.serviceKey
stringConditional

PagerDuty service key.

If the key later becomes invalid, Atlas sends an email to the Project Owner and eventually removes the key.

Set this value if you set notifications.[n].typeName to PAGER_DUTY.

notifications.[n]
.severity
stringOptional

Degree of seriousness of this notification.

Atlas accepts the following values:

  • CRITICAL
  • ERROR
  • WARNING
notifications.[n]
.smsEnabled
booleanConditional

Flag indicating if text message notifications should be sent to this user's mobile phone.

Set this value if you set notifications.[n].typeName to ORG, GROUP, or USER.

notifications.[n]
.teamId
stringConditional

Unique identifier of a team.

Set this value if you set notifications.[n].typeName to TEAM.

notifications.[n]
.typeName
stringRequired

Means by which you want Atlas to send you notification of an alert. Atlas accepts the following values:

  • EMAIL
  • SMS
  • PAGER_DUTY
  • SLACK
  • FLOWDOCK
  • DATADOG
  • OPS_GENIE
  • VICTOR_OPS
  • WEBHOOK
  • USER
  • TEAM
  • GROUP (Project)
  • ORG
notifications.[n]
.username
stringConditional

Name of the Atlas user to which to send notifications. This user must belong in the project that owns the alert configuration.

Set this value if you set notifications.[n].typeName to USER.

notifications.[n]
.victorOpsApiKey
stringConditional

VictorOps API key.

If the key later becomes invalid, Atlas sends an email to the Project Owner and eventually removes the key.

Set this value if you set notifications.[n].typeName to VICTOR_OPS.

notifications.[n]
.victorOpsRoutingKey
stringConditional

VictorOps routing key.

If the key later becomes invalid, Atlas sends an email to the Project Owner and eventually removes the key.

Set this value if you set notifications.[n].typeName to VICTOR_OPS.

The response includes the alert configuration details:

Info With Circle IconCreated with Sketch.Note

Alert configurations vary. An alert configuration may only include a subset of these elements.

NameTypeDescription
createdstringTimestamp in ISO 8601 date and time format in UTC when this alert configuration was created.
enabledbooleanFlag indicating this alert configuration enabled.
eventTypeNamestringType of event that triggers an alert.
groupIdstringUnique identifier of the Project that owns this alert configuration.
idstringUnique identifier of the alert configuration.
linksarray of objectsOne or more links to sub-resources and/or related resources. The relation-types between URL s are explained in the Web Linking Specification.
matchersarray of objectsRules to apply when matching an object against this alert configuration.
matchers
.[n].fieldName
stringName of the field in the target object that you wanted this configuration to match.
matchers
.[n].operator
stringComparison operator to apply when checking the current metric value against matcher.[n].value.
matchers
.[n].value
stringValue to match or exceed using matchers.[n].operator.
metricThresholdobjectValue and means of comparison that triggers an alert.
metricThreshold
.metricName
stringName of the metric to check. Supports the same values as the metricName field of the alerts resource.
metricThreshold
.mode
stringAverage value of this metric.
metricThreshold
.operator
stringComparison operator that Atlas applied when checking the current metric value against the threshold value.
metricThreshold
.threshold
numberValue of metricThreshold.metricName that, when exceeded, triggers an alert.
metricThreshold
.units
stringUnits of capacity or time that define the scope of the metricThreshold.threshold.
notificationsarray of objectsOne or more targets for Atlas to send notifications when an alert condition is detected.
notifications.[n]
.apiToken
stringSlack API token token. Atlas returns this value if you set notifications.[n].typeName to SLACK.
notifications.[n]
.channelName
stringSlack channel name. Atlas returns this value if you set notifications.[n].typeName to SLACK.
notifications.[n]
.datadogApiKey
stringDataDog API Key. Atlas returns this value if you set notifications.[n].typeName to DATADOG.
notifications.[n]
.datadogRegion
stringRegion that indicates which API URL to use.
notifications.[n]
.delayMin
numberNumber of minutes to wait after an alert condition is detected before sending out the first notification.
notifications.[n]
.emailAddress
stringEmail address to which to send notification. Atlas returns this value if you set notifications.[n].typeName to EMAIL.
notifications.[n]
.emailEnabled
booleanFlag indicating email notifications must be sent. Atlas returns this value if you set notifications.[n].typeName to ORG, GROUP, or USER.
notifications.[n]
.flowdockApiToken
stringFlowdock personal API token. Atlas returns this value if you set notifications.[n].typeName to FLOWDOCK.
notifications.[n]
.flowName
stringName of the Flowdock flow. Atlas returns this value if you set notifications.[n].typeName to FLOWDOCK.
notifications.[n]
.intervalMin
numberNumber of minutes to wait between successive notifications for unacknowledged alerts that are not resolved.
notifications.[n]
.mobileNumber
stringMobile number to which alert notifications are sent. Atlas returns this value if you set notifications.[n].typeName to SMS.
notifications.[n]
.notificationToken
string

HipChat API token. Atlas returns this value if you set notifications.[n].typeName to HIP_CHAT.

If the token later becomes invalid, Atlas sends an email to the Project Owner and eventually removes the token.

notifications.[n]
.opsGenieApiKey
stringOpsgenie API Key. Atlas returns this value if you set notifications.[n].typeName to OPS_GENIE.
notifications.[n]
.opsGenieRegion
stringRegion that indicates which API URL to use. Atlas returns this value if you set notifications.[n].typeName to OPS_GENIE.
notifications.[n]
.orgName
stringName of the Flowdock organization. Atlas returns this value if you set notifications.[n].typeName to FLOWDOCK.
notifications.[n]
.roles
array of stringsAtlas role in current Project or Organization. Atlas returns this value if you set notifications.[n].typeName to ORG or GROUP.
notifications.[n]
.roomName
stringHipChat room name. Atlas returns this value if "notifications.typeName" : "HIP_CHAT.
notifications.[n]
.serviceKey
stringPagerDuty service key. Atlas returns this value if you set notifications.[n].typeName to PAGER_DUTY.
notifications.[n]
.severity
stringDegree of seriousness of this notification.
notifications.[n]
.smsEnabled
booleanFlag indicating text notifications must be sent. Atlas returns this value if you set notifications.[n].typeName to ORG, GROUP, or USER.
notifications.[n]
.teamId
stringUnique identifier of the team that receives this notification.
notifications.[n]
.teamName
stringLabel for the team that receives this notification.
notifications.[n]
.typeName
stringMeans by which you want Atlas to send you notification of an alert.
notifications.[n]
.username
stringName of an Atlas user to which to send notifications. Atlas returns this value if you set notifications.[n].typeName to USER.
notifications.[n]
.victorOpsApiKey
string

VictorOps API key.

If the key later becomes invalid, Atlas sends an email to the Project Owner and eventually removes the key.

Atlas returns this value if you set notifications.[n].typeName to VICTOR_OPS.

notifications.[n]
.victorOpsRoutingKey
string

VictorOps routing key.

If the key later becomes invalid, Atlas sends an email to the Project Owner and eventually removes the key.

Atlas returns this value if you set notifications.[n].typeName to VICTOR_OPS.

thresholdobjectThreshold that triggers an alert. Atlas returns this value if eventTypeName is any value other than OUTSIDE_METRIC_THRESHOLD.
threshold
.operator
stringComparison operator that Atlas applied when checking the current metric value against the threshold value.
threshold
.threshold
numberValue that, when exceeded, Atlas triggers an alert.
threshold
.units
stringUnits of capacity or time that define the scope of the threshold.threshold.
typeNamestringThis field is deprecated and is ignored.
updatedstringTimestamp in ISO 8601 date and time format in UTC when this alert configuration was last updated.
1curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
2 --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/alertConfigs" \
3 --header "Content-Type: application/json" \
4 --data '
5 {
6 "eventTypeName" : "REPLICATION_OPLOG_WINDOW_RUNNING_OUT",
7 "enabled" : true,
8 "notifications" : [ {
9 "delayMin" : 0,
10 "emailEnabled" : true,
11 "intervalMin" : 60,
12 "roles" : [ "GROUP_OWNER" ],
13 "smsEnabled" : false,
14 "typeName" : "GROUP"
15 } ],
16 "threshold" : {
17 "operator" : "LESS_THAN",
18 "threshold" : 1,
19 "units" : "HOURS"
20 },
21 "typeName" : "REPLICA_SET"
22 }'
1{
2 "created":"2020-02-26T01:14:40Z",
3 "enabled":true,
4 "eventTypeName":"REPLICATION_OPLOG_WINDOW_RUNNING_OUT",
5 "groupId":"{PROJECT-ID}",
6 "id":"{ALERT-CONFIG-ID}",
7 "links":[{
8 "href":"https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/alertConfigs/{ALERT-CONFIG-ID}",
9 "rel":"self"
10 },
11 {
12 "href":"https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/alertConfigs/{ALERT-CONFIG-ID}/alerts",
13 "rel":"http://mms.mongodb.com/alerts"
14 }],
15 "matchers":[],
16 "notifications":[{
17 "delayMin":0,
18 "emailEnabled":true,
19 "intervalMin":60,
20 "roles":["GROUP_OWNER"],
21 "smsEnabled":false,
22 "typeName":"GROUP"
23 }],
24 "threshold":{
25 "operator":"LESS_THAN",
26 "threshold":1,
27 "units":"HOURS"
28 },
29 "typeName":"REPLICA_SET",
30 "updated":"2020-02-26T01:14:40Z"
31}
Give Feedback