Update an Alert Configuration
On this page
- OAuth 2.0 authentication for programmatic access to Cloud Manager is available as a Preview feature.
- The feature and the corresponding documentation might change at any time during the Preview period. To use OAuth 2.0 authentication, create a service account to use in your requests to the Cloud Manager Public API.
Note
Groups and projects are synonymous terms. Your {PROJECT-ID}
is the
same as your project id. For existing groups, your group/project id
remains the same. This page uses the more familiar term group when
referring to descriptions. The endpoint remains as stated in the
document.
Base URL: https://cloud.mongodb.com/api/public/v1.0
Resource
PUT /groups/{PROJECT-ID}/alertConfigs/{ALERT-CONFIG-ID}
Note
To update just the enabled/disabled state for the alert configuration, see Enable/Disable Alert Configuration instead.
Request Path Parameters
All request path parameters are required.
Parameter | Type | Description |
---|---|---|
PROJECT-ID | string | Unique identifier for this Project. |
ALERT-CONFIG-ID | string | Unique identifier for this alert configuration. |
Request Query Parameters
The following query parameters are optional:
Name | Type | Necessity | Description | Default | ||||||
---|---|---|---|---|---|---|---|---|---|---|
pretty | boolean | Optional | Flag indicating whether the response body should be in a
prettyprint format. | false | ||||||
envelope | boolean | Optional | Flag that indicates whether or not to wrap 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. For endpoints that return one result, the response body includes:
| false |
Request Body Parameters
Note
Alert configurations vary. An alert configuration may only include a subset of these elements.
Name | Type | Description | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
enabled | boolean | If omitted, the configuration is disabled. | ||||||||||||||||||||||
eventTypeName Required | string | The type of event that triggers an alert. Values include: Agent Automation Configuration Backup BI Connector Billing Cluster Data Explorer Accessed Disk Backup Host Organization Project Replica Set Support Case Team User To review the full list of events that generate alerts and their descriptions, see Alert Types. | ||||||||||||||||||||||
matchers.fieldName | string | Name of the field in the target object to match on.
All other types of alerts do not support matchers. | ||||||||||||||||||||||
matchers.operator | string | Operator to test the field's value. Accepted values are:
| ||||||||||||||||||||||
matchers.value | string | Value to test with the specified operator. If
| ||||||||||||||||||||||
matchers | object array | Rules to apply when matching an object against this alert configuration. Only entities that match all these rules are checked for an alert condition. You can filter using the | ||||||||||||||||||||||
metricThreshold.metricName | string | Name of the metric to check. Supports the same values as
the metricName field of the alerts resource. | ||||||||||||||||||||||
metricThreshold.mode | string | Set to AVERAGE to compute the average of this metric. | ||||||||||||||||||||||
metricThreshold.operator | string | Operator to apply when checking the current metric value against the threshold value. Accepted values are:
| ||||||||||||||||||||||
metricThreshold.threshold | number | Threshold value outside of which an alert is triggered. | ||||||||||||||||||||||
metricThreshold.units | string | Units for the threshold value. Depends on the type of metric. For example, a metric that measures memory consumption would have a byte measurement, while a metric that measures time would have a time unit. Accepted values are:
| ||||||||||||||||||||||
metricThreshold | object | Threshold that will cause an alert to be triggered.
Required if "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD" . | ||||||||||||||||||||||
notifications.apiToken | string | Slack API token or Bot token.
Required if After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
| ||||||||||||||||||||||
notifications.channelName | string | Slack channel name.
Required if "notifications.typeName" : "SLACK" . | ||||||||||||||||||||||
notifications.datadogApiKey | string | DataDog API Key. Found in the DataDog dashboard.
Required if After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
| ||||||||||||||||||||||
notifications.delayMin | number | Number of minutes to wait after an alert condition is
detected before sending out the first notification. | ||||||||||||||||||||||
notifications.emailAddress | string | Email address to which to send notification.
Required if "notifications.typeName" : "EMAIL" . | ||||||||||||||||||||||
notifications.emailEnabled | boolean | Determines if email notifications should be sent. Required if:
| ||||||||||||||||||||||
notifications.intervalMin | number | Number of minutes to wait between successive notifications
for unacknowledged alerts that are not resolved. | ||||||||||||||||||||||
notifications.webhookSecret | string | A value used to authenticate with the Webhook that accepts and forwards the notification. You can explicitly declare a secret only in a request that has both:
You can configure a To explicitly declare a After creating a webhook notification, the URL is partially redacted when you view or edit the alert, and the secret is completely redacted. | ||||||||||||||||||||||
notifications.webhookUrl | string | URL for the webhook that triggers this notification. If you
do not explicitly declare a After creating a webhook notification, the URL is partially redacted when you view or edit the alert, and the secret is completely redacted. | ||||||||||||||||||||||
notifications.microsoftTeamsWebhookUrl | string | Microsoft Teams channel incoming webhook URL.
Required if When you view or edit the alert for a webhook notification, the URL appears partially redacted, and the secret appears completely redacted. | ||||||||||||||||||||||
notifications.mobileNumber | string | Mobile number to send SMS messages to.
Required if "notifications.typeName" : "SMS" . | ||||||||||||||||||||||
notifications.notificationToken | string | A HipChat API token.
Required if After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
| ||||||||||||||||||||||
notifications.role | string | One or more project roles that receive the configured alert. Accepted values include:
If you include this field, Cloud Manager sends alerts only to users assigned the roles you specify in the array. If you omit this field, Cloud Manager sends alerts to users assigned any role. Configurable for | ||||||||||||||||||||||
notifications.roomName | string | HipChat room name.
Required if "notifications.typeName" : "HIP_CHAT" . | ||||||||||||||||||||||
notifications.serviceKey | string | PagerDuty integration key.
Required if "notifications.typeName" : "PAGER_DUTY" . | ||||||||||||||||||||||
notifications.smsEnabled | boolean | Flag indicating SMS notifications must be sent. Required if:
| ||||||||||||||||||||||
notifications.teamId | string | Unique identifier of a team. | ||||||||||||||||||||||
notifications.typeName | string | Type of alert notification. Accepted values are:
| ||||||||||||||||||||||
notifications.username | string | Name of a Cloud Manager user to which to send notifications.
Specify a user in the Project that owns the alert
configuration.
Required if "notifications.typeName" : "USER" . | ||||||||||||||||||||||
notifications Required | object array | Notifications to send when an alert condition is
detected. | ||||||||||||||||||||||
threshold.operator | string | Operator to apply when checking the current metric value against the threshold value.
| ||||||||||||||||||||||
threshold.threshold | number | Threshold value outside of which an alert is triggered. | ||||||||||||||||||||||
threshold | object | Threshold that will cause an alert to be triggered. Required if:
|
Response
The response includes the alert configuration details:
Note
Alert configurations vary. An alert configuration may only include a subset of these elements.
Name | Type | Description |
---|---|---|
created | string | Timestamp in ISO 8601 date and time format in UTC when this alert configuration was created. |
enabled | boolean | Flag indicating this alert configuration enabled. |
eventTypeName | string | Type of event that triggers an alert. |
groupId | string | Unique identifier of the Project that owns this alert
configuration. |
id | string | Unique identifier of the alert configuration. |
links | array of objects | One or more links to sub-resources and/or related resources. The relation-types between URLs are explained in the Web Linking Specification. |
matchers | array of objects | Rules to apply when matching an object against this alert
configuration. |
matchers .[n].fieldName | string | Name of the field in the target object that you wanted this
configuration to match. |
matchers .[n].operator | string | Comparison operator to apply when checking the current metric
value against matcher.[n].value . |
matchers .[n].value | string | Value to match or exceed using matchers.[n].operator . |
metricThreshold | object | Value and means of comparison that triggers an alert. |
metricThreshold .metricName | string | Name of the metric to check. Supports the same values as
the metricName field of the alerts resource. |
metricThreshold .mode | string | Average value of this metric. |
metricThreshold .operator | string | Comparison operator that Cloud Manager applied when checking the
current metric value against the threshold value. |
metricThreshold .threshold | number | Value of metricThreshold.metricName that, when exceeded,
triggers an alert. |
metricThreshold .units | string | Units of capacity or time that define the scope of the
metricThreshold.threshold . |
notifications | array of objects | One or more targets for Cloud Manager to send notifications when
an alert condition is detected. |
notifications.[n] .apiToken | string | Slack API token token. Cloud Manager returns this value if you
set After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
|
notifications.[n] .channelName | string | Slack channel name. Cloud Manager returns this value if you set
notifications.[n].typeName to SLACK . |
notifications.[n] .datadogApiKey | string | DataDog API Key. Cloud Manager returns this value if you set
After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
|
notifications.[n] .delayMin | number | Number of minutes to wait after an alert condition is
detected before sending out the first notification. |
notifications.[n] .emailAddress | string | Email address to which to send notification. Cloud Manager
returns this value if you set notifications.[n].typeName
to EMAIL . |
notifications.[n] .emailEnabled | boolean | Flag indicating email notifications must be sent. Cloud Manager
returns this value if you set notifications.[n].typeName
to ORG , GROUP , or USER . |
notifications.[n] .intervalMin | number | Number of minutes to wait between successive notifications
for unacknowledged alerts that are not resolved. |
notifications.[n] .microsoftTeamsWebhookUrl | string | Microsoft Teams channel incoming webhook URL.
Cloud Manager returns this value if
you set When you view or edit the alert for a webhook notification, the URL appears partially redacted, and the secret appears completely redacted. |
notifications.[n] .mobileNumber | string | Mobile number to which alert notifications are sent.
Cloud Manager returns this value if you set
notifications.[n].typeName to SMS . |
notifications.[n] .notificationToken | string | HipChat API token. Cloud Manager returns this value if you set
If the token later becomes invalid, MongoDB Atlas sends an email to the
After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
|
notifications.[n] .opsGenieApiKey | string | OpsGenie Alert API
key. Cloud Manager returns this value if you set
After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
|
notifications.[n] .opsGenieRegion | string | Region that indicates which API URL to use. Cloud Manager returns
this value if you set notifications.[n].typeName to
OPS_GENIE . |
notifications.[n] .roles | array of strings | Cloud Manager role in current Project or Organization. Cloud Manager returns
this value if you set notifications.[n].typeName to
ORG or GROUP . |
notifications.[n] .roomName | string | HipChat room name. Cloud Manager returns this value if
"notifications.typeName" : "HIP_CHAT . |
notifications.[n] .serviceKey | string | PagerDuty service key. Cloud Manager returns this value if
you set After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
|
notifications.[n] .smsEnabled | boolean | Flag indicating text notifications must be sent. Cloud Manager
returns this value if you set notifications.[n].typeName to
ORG , GROUP , or USER . |
notifications.[n] .teamId | string | Unique identifier of the team that receives this
notification. |
notifications.[n] .teamName | string | Label for the team that receives this notification. |
notifications.[n] .typeName | string | Means by which you want Cloud Manager to send you notification of an
alert. |
notifications.[n] .username | string | Name of a Cloud Manager user to which to send notifications.
Cloud Manager returns this value if you set
notifications.[n].typeName to USER . |
notifications.[n] .victorOpsApiKey | string | VictorOps API key. If the key later becomes invalid, MongoDB Atlas sends an email to the
Cloud Manager returns this value if you set
After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
|
notifications.[n] .victorOpsRoutingKey | string | VictorOps routing key. If the key later becomes invalid, MongoDB Atlas sends an email to the
Cloud Manager returns this value if you set
After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
|
notifications.[n] .webhookSecret | string | A value used to authenticate with the Webhook that accepts and forwards the notification. Cloud Manager returns this value if you set
After creating a webhook notification, the URL is partially redacted when you view or edit the alert, and the secret is completely redacted. |
notifications.[n] .webhookUrl | string | URL for the webhook that triggers this notification. Cloud Manager returns this value if you set
After creating a webhook notification, the URL is partially redacted when you view or edit the alert, and the secret is completely redacted. |
threshold | object | Threshold that triggers an alert. Cloud Manager returns this value
if eventTypeName is any value other than
OUTSIDE_METRIC_THRESHOLD . |
threshold .operator | string | Comparison operator that Cloud Manager applied when checking the
current metric value against the threshold value. |
threshold .threshold | number | Value that, when exceeded, Cloud Manager triggers an alert. |
threshold .units | string | Units of capacity or time that define the scope of the
threshold.threshold . |
typeName | string | This field is deprecated and is ignored. |
updated | string | Timestamp in ISO 8601 date and time format in UTC when this alert configuration was last
updated. |
Example Request
curl --user '{PUBLIC-KEY}:{PRIVATE-KEY}' --digest \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --include \ --request PUT "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/alertConfigs/{ALERT-CONFIG-ID}" \ --data ' { "eventTypeName" : "RESYNC_REQUIRED", "enabled" : true, "matchers" : [ { "fieldName" : "REPLICA_SET_NAME", "operator" : "EQUALS", "value" : "rs1" } ], "notifications" : [ { "typeName" : "EMAIL", "emailAddress" : "sos@example.com", "intervalMin" : 60, "delayMin" : 5 }, { "typeName" : "GROUP", "intervalMin" : 120, "delayMin" : 60, "smsEnabled" : true, "emailEnabled" : false } ] }'
Example Response
Response Header
401 Unauthorized Content-Type: application/json;charset=ISO-8859-1 Date: {dateInUnixFormat} WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false Content-Length: {requestLengthInBytes} Connection: keep-alive
200 OK Vary: Accept-Encoding Content-Type: application/json Strict-Transport-Security: max-age=300 Date: {dateInUnixFormat} Connection: keep-alive Content-Length: {requestLengthInBytes} X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
Response Body
{ "created" : "2014-04-23T14:52:29Z", "enabled" : false, "groupId" : "{PROJECT-ID}", "id" : "{ALERT-CONFIG-ID}", "links" : [], "matchers" : [ { "fieldName" : "REPLICA_SET_NAME", "operator" : "EQUALS", "value" : "rs1" } ], "notifications" : [ { "delayMin" : 5, "emailAddress" : "sos@example.com", "intervalMin" : 60, "typeName" : "EMAIL" }, { "delayMin" : 60, "emailEnabled" : false, "intervalMin" : 120, "smsEnabled" : true, "typeName" : "GROUP" } ], "updated" : "2014-04-23T14:56:25Z" }