Navigation

Get All Alerts

Base URL: https://cloud.mongodb.com/

Syntax

GET /api/public/v1.0/groups/{GROUP-ID}/alerts

Request Path Parameters

Parameter Required/Optional Description
GROUP-ID Required Group identifier.

Request Query Parameters

Field Required/Optional Description
status Optional.

Specify a status to return only those alerts with the specified status. Omit to return all alerts

Possible values are:

  • TRACKING

    To return alerts with TRACKING status. If an alert’s configuration specifies a notification delay, MongoDB Atlas assigns the alert the TRACKING status until the delay period ends. After the delay, MongoDB Atlas sets the status to OPEN, if the condition persists.

    If an alert’s configuration has multiple notifications, each with its own notification delay, MongoDB Atlas uses the smallest delay value to determine when to move the alert from TRACKING to OPEN.

  • OPEN

    To return all open alerts.

  • CLOSED

    To return all closed alerts.

pageNum Optional. The page to return.
itemsPerPage Optional. Maximum number of items to return per page. Default is 100.
envelope Optional. A boolean that specifies whether or not to wrap the response in an envelope.

Request Body Parameters

This endpoint does not use HTTP request body parameters.

Response Elements

The response includes the totalCount of the alerts and a results array with the list of alert details. Each alert information includes:

Note

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

Name Type Description
id string Unique identifier.
groupId string ID of the group that owns this alert configuration.
eventTypeName string

The type of event that will trigger an alert.

  • Host alerts support these values:
    • HOST_DOWN
    • HOST_RECOVERING
    • VERSION_BEHIND
    • HOST_EXPOSED
    • OUTSIDE_METRIC_THRESHOLD
  • Agent alerts support these values:
    • MONITORING_AGENT_DOWN
    • MONITORING_AGENT_VERSION_BEHIND
    • BACKUP_AGENT_DOWN
    • BACKUP_AGENT_VERSION_BEHIND
    • BACKUP_AGENT_CONF_CALL_FAILURE
  • Backup alerts support these values:
    • OPLOG_BEHIND
    • CLUSTER_MONGOS_IS_MISSING
    • RESYNC_REQUIRED
    • BAD_CLUSTERSHOTS
  • Group alerts support these values:
    • USERS_AWAITING_APPROVAL
    • USERS_WITHOUT_MULTI_FACTOR_AUTH
  • Replica set alerts support these values:
    • CONFIGURATION_CHANGED
    • PRIMARY_ELECTED
    • TOO_FEW_HEALTHY_MEMBERS
    • TOO_MANY_UNHEALTHY_MEMBERS
    • NO_PRIMARY
  • Sharded cluster alerts support this value:
    • CLUSTER_MONGOS_IS_MISSING
  • User alerts support these values:
    • JOINED_GROUP
    • REMOVED_FROM_GROUP
typeName string This field is deprecated and will be ignored.
created date When this alert configuration was created.
updated date When this alert configuration was last updated.
enabled boolean Is this alert configuration enabled?
matchers object array

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

You can filter using the matchers array only when the eventTypeName specifies an event for a host, replica set, or sharded cluster.

matchers.fieldName string

The name of the field in the target object to match on.

  • Host alerts support these fields:
    • HOSTNAME
    • PORT
    • HOSTNAME_AND_PORT
    • REPLICA_SET_NAME
    • TYPE_NAME
  • Replica set alerts support these fields:
    • REPLICA_SET_NAME
    • SHARD_NAME
    • CLUSTER_NAME
  • Sharded cluster alerts support these fields:
    • CLUSTER_NAME
    • SHARD_NAME

All other types of alerts do not support matchers.

matchers.operator string

The operator to test the field’s value. Possible values are:

  • EQUALS
  • NOT_EQUALS
  • CONTAINS
  • NOT_CONTAINS
  • STARTS_WITH
  • ENDS_WITH
  • REGEX
matchers.value string

The value to test with the specified operator.

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

  • PRIMARY
  • SECONDARY
  • STANDALONE
  • CONFIG
  • MONGOS
notifications object array Notifications to send when an alert condition is detected.
notifications.typeName string

The type of alert notification. Possible values are:

  • GROUP
  • USER
  • EMAIL
  • SMS
  • HIPCHAT
  • SLACK
  • FLOWDOCK
  • PAGER_DUTY
  • WEBHOOK
notifications.intervalMin number The number of minutes to wait between successive notifications for unacknowledged alerts that are not resolved.
notifications.delayMin number The number of minutes to wait after an alert condition is detected before sending out the first notification.
notifications.emailEnabled boolean Should email notifications be sent? Only present for notifications of type GROUP and USER.
notifications.smsEnabled boolean Should SMS notifications be sent? Only present for notifications of type GROUP and USER.
notifications.username string The name of a Cloud Manager user to which to send notifications. Only a user in the group that owns the alert configuration is allowed here. Only present for notifications of type USER.
notifications.emailAddress string The email address to which to send notification. Only present for notifications of type EMAIL.
notifications.mobileNumber string Mobile number to send SMS messages to. Only present for notifications of type SMS.
notifications.notificationToken string A HipChat API token. Only present for notifications of type HIP_CHAT. If the token later becomes invalid, Cloud Manager sends an email to the group owner and eventually removes the token.
notifications.roomName string HipChat room name. Only present for notifications of type HIP_CHAT.
notifications.channelName string The Slack channel name. Only present for SLACK notifications.
notifications.apiToken string The Slack API token or Bot token. Only present for SLACK notifications. If the token later becomes invalid, Cloud Manager sends an email to the group owner and eventually removes the token.
notifications.orgName string The Flowdock organization name in lower-case letters. This is the name that appears after www.flowdock.com/app/ in the URL string. Only present for FLOWDOCK notifications.
notifications.flowName string

The flow name, in lower-case letters. Only present for FLOWDOCK notifications. The flow name appears after the organization name in the URL string:

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

notifications.flowdockApiToken string The Flowdock “personal API token.” Only present for FLOWDOCK notifications. If the token later becomes invalid, Cloud Manager sends an email to the group owner and eventually removes the token.
notifications.serviceKey string PagerDuty service key. Only present for PAGER_DUTY notifications. If the key later becomes invalid, Cloud Manager sends an email to the group owner and eventually removes the key.
metricThreshold object The threshold that will cause an alert to be triggered. Only present if eventTypeName is set to OUTSIDE_METRIC_THRESHOLD.
metricThreshold.metricName string The name of the metric to check. Supports the same values as the metricName field of the alerts resource.
metricThreshold.operator string

The operator to apply when checking the current metric value against the threshold value. Possible values are:

  • GREATER_THAN
  • LESS_THAN
metricThreshold.threshold number The threshold value outside of which an alert will be triggered.
metricThreshold.units string

The 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. Possible values are:

  • RAW
  • BITS
  • BYTES
  • KILOBITS
  • KILOBYTES
  • MEGABITS
  • MEGABYTES
  • GIGABITS
  • GIGABYTES
  • TERABYTES
  • PETABYTES
  • MILLISECONDS
  • SECONDS
  • MINUTES
  • HOURS
  • DAYS
metricThreshold.mode string This is set to AVERAGE and computes the current metric value as an average.
threshold object

The threshold that will cause an alert to be triggered. Only present if eventTypeName is set to one of the following:

  • TOO_FEW_HEALTHY_MEMBERS
  • TOO_MANY_UNHEALTHY_MEMBERS
threshold.operator string

The operator to apply when checking the current metric value against the threshold value.

  • GREATER_THAN
  • LESS_THAN
threshold.threshold number The threshold value outside of which an alert will be triggered.

Measurement Types for Alerts

The alerts resource returns measurement types in the metricName field. The field is present only if eventTypeName is set to OUTSIDE_METRIC_THRESHOLD.

Host Measurements

  • ASSERT_REGULAR
  • ASSERT_WARNING
  • ASSERT_MSG
  • ASSERT_USER
Measure the rate of asserts for a MongoDB process, as collected from the MongoDB serverStatus command’s asserts document.
  • BACKGROUND_FLUSH_AVG
Measurement found on the host’s background flush avg chart. To view the chart, see View Metrics.
  • CACHE_BYTES_READ_INTO
  • CACHE_BYTES_WRITTEN_FROM
  • CACHE_USAGE_DIRTY
  • CACHE_USAGE_USED
  • TICKETS_AVAILABLE_READS
  • TICKETS_AVAILABLE_WRITES
Apply to a MongoDB process’s WiredTiger storage engine, as collected from the MongoDB serverStatus command’s wiredTiger.cache and wiredTiger.concurrentTransactions documents.
  • CONNECTIONS
Measures connections to a MongoDB process, as collected from the MongoDB serverStatus command’s connections document.
  • CURSORS_TOTAL_OPEN
  • CURSORS_TOTAL_TIMED_OUT
Measure the number of cursors for a MongoDB process, as collected from the MongoDB serverStatus command’s metrics.cursor document.
  • EXTRA_INFO_PAGE_FAULTS
  • GLOBAL_ACCESSES_NOT_IN_MEMORY
  • GLOBAL_PAGE_FAULT_EXCEPTIONS_THROWN
Measurements found on the host’s Record Stats and Page Faults charts. To view the charts, see View Metrics.
  • GLOBAL_LOCK_CURRENT_QUEUE_TOTAL
  • GLOBAL_LOCK_CURRENT_QUEUE_READERS
  • GLOBAL_LOCK_CURRENT_QUEUE_WRITERS
Measure operations waiting on locks, as collected from the MongoDB serverStatus command. Cloud Manager computes these values based on the type of storage engine.
  • GLOBAL_LOCK_PERCENTAGE
Applicable only to hosts running MongoDB 2.0 and earlier. Measures operations waiting on the global lock, as collected from the MongoDB serverStatus command.
  • INDEX_COUNTERS_BTREE_ACCESSES
  • INDEX_COUNTERS_BTREE_HITS
  • INDEX_COUNTERS_BTREE_MISSES
  • INDEX_COUNTERS_BTREE_MISS_RATIO
Measurements found on the host’s btree chart. To view the chart, see View Metrics.
  • JOURNALING_COMMITS_IN_WRITE_LOCK
  • JOURNALING_MB
  • JOURNALING_WRITE_DATA_FILES_MB
Measurements found on the host’s journal - commits in write lock chart and journal stats chart. To view the charts, see View Metrics.
  • MEMORY_RESIDENT
  • MEMORY_VIRTUAL
  • MEMORY_MAPPED
  • COMPUTED_MEMORY
Measure memory for a MongoDB process, as collected from the MongoDB serverStatus command’s mem document.
  • NETWORK_BYTES_IN
  • NETWORK_BYTES_OUT
  • NETWORK_NUM_REQUESTS
Measure throughput for MongoDB process, as collected from the MongoDB serverStatus command’s network document.
  • OPLOG_SLAVE_LAG_MASTER_TIME
  • OPLOG_MASTER_TIME
  • OPLOG_MASTER_LAG_TIME_DIFF
  • OPLOG_RATE_GB_PER_HOUR
Measurements that apply to the MongoDB process’s oplog.
  • DB_STORAGE_TOTAL
  • DB_DATA_SIZE_TOTAL
Measurements displayed on the host’s db storage chart. To view the chart, see View Metrics.
  • OPCOUNTER_CMD
  • OPCOUNTER_QUERY
  • OPCOUNTER_UPDATE
  • OPCOUNTER_DELETE
  • OPCOUNTER_GETMORE
  • OPCOUNTER_INSERT
Measure the rate of database operations on a MongoDB process since the process last started, as collected from the MongoDB serverStatus command’s opcounters document.
  • OPCOUNTER_REPL_CMD
  • OPCOUNTER_REPL_UPDATE
  • OPCOUNTER_REPL_DELETE
  • OPCOUNTER_REPL_INSERT
Measure the rate of database operations on MongoDB secondaries, as collected from the MongoDB serverStatus command’s opcountersRepl document.
  • DOCUMENT_RETURNED
  • DOCUMENT_INSERTED
  • DOCUMENT_UPDATED
  • DOCUMENT_DELETED
The average rate per second of documents returned, inserted, updated, or deleted for a selected time period. These measurements are found on the host’s Document Metrics chart. To view the chart, see View Metrics.
  • OPERATIONS_SCAN_AND_ORDER
For a selected time period, the average rate per second for operations that perform a sort but cannot perform the sort using an index. This measurement is found on the host’s Scan and Order chart. To view the chart, see View Metrics.
  • AVG_READ_EXECUTION_TIME
  • AVG_WRITE_EXECUTION_TIME
  • AVG_COMMAND_EXECUTION_TIME
Available to hosts running MongoDB v3.4+. The average execution time in milliseconds per read, write, or command operation over the selected time period. These measurements are found on the host’s Operation Execution Times chart. To view the chart, see View Metrics.
  • QUERY_EXECUTOR_SCANNED
The average rate per second to scan index items during queries and query-plan evaluations. This rate is driven by the same value as totalKeysExamined in the output of explain. This measurement is found on the host’s Query Executor chart, accessed when viewing metrics.
  • QUERY_EXECUTOR_SCANNED_OBJECTS
The average rate per second to scan documents during queries and query-plan evaluations. Cloud Manager derives the rate using the explain output’s totalDocsExamined value. This measurement is found on the host’s Query Executor chart, accessed when viewing metrics.
  • QUERY_TARGETING_SCANNED_PER_RETURNED
The ratio of the number of index items scanned to the number of documents returned. This measurement is found on the host’s Query Targeting chart, accessed when viewing metrics.
  • QUERY_TARGETING_SCANNED_OBJECTS_PER_RETURNED
The ratio of the number of documents scanned to the number of documents returned. This measurement is found on the host’s Query Targeting chart, accessed when viewing metrics.

Example Request

The following returns all OPEN alerts:

curl -X GET -u "username:apiKey" --digest "https://cloud.mongodb.com/api/public/v1.0/groups/5196d3628d022db4cbc26d9e/alerts?status=OPEN"

Example Response

{
  "totalCount": 1,
  "results": [ {
    "alertConfigId":"55e756a6e4b0fa1210c695a2",
    "id" : "533dc45ee4b00835ff81ec2a",
    "groupId" : "5196d3628d022db4cbc26d9e",
    "hostId":"51714c7fa22cbe473a9573d3629ff53c",
    "hostnameAndPort":"example.test.4182.mongodbdns.com:27017",
    "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD",
    "status" : "OPEN",
    "created" : "2014-04-03T20:28:14Z",
    "updated" : "2014-04-03T20:28:14Z",
    "lastNotified" : "2014-04-03T20:28:23Z",
    "metricName": "ASSERTS_REGULAR",
    "currentValue" : {
      "number" : 0.0,
      "units" : "RAW"
    },
    "links" : [ ... ]
  } ],
  "links" : [ ... ]
}
←   Alerts Get an Alert  →