Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of MongoDB Ops Manager, refer to the upgrade documentation.
You were redirected from a different version of the documentation. Click here to go back.

Alert Configurations

An alert configuration defines the conditions that trigger an alert and the methods of notification.

Endpoints

Get All Alert Configurations in a Group

Get all alert configurations for a group.

GET /api/public/v1.0/groups/GROUP-ID/alertConfigs

Get an Alert Configuration

Get a single alert configuration by its ID.

GET /api/public/v1.0/groups/GROUP-ID/alertConfigs/ALERT-CONFIG-ID

Get All Open Alerts Triggered by an Alert Configuration

Get all open alerts that were triggered by an alert configuration.

GET /api/public/v1.0/groups/GROUP-ID/alertConfigs/ALERT-CONFIG-ID/alerts

Create an Alert Configuration

All fields are required except created and updated.

POST /api/public/v1.0/groups/GROUP-ID/alertConfigs

Update an Alert Configuration

For most updates, you must use PUT and send the entire entity. The only exception is for updates to the enabled field, as described in Enable or Disable an Alert Configuration.

PUT /api/public/v1.0/groups/GROUP-ID/alertConfigs/ALERT-CONFIG-ID

Enable or Disable an Alert Configuration

Use to enable/disable an alert configuration by setting the enabled field.

PATCH /api/public/v1.0/groups/GROUP-ID/alertConfigs/ALERT-CONFIG-ID

Delete an Alert Configuration

DELETE /api/public/v1.0/groups/GROUP-ID/alertConfigs/ALERT-CONFIG-ID

Sample Entity

{
  "id": "yyy",
  "groupId": "xxx",
  "typeName": "HOST_METRIC",
  "eventTypeName": "OUTSIDE_METRIC_THRESHOLD",
  "created": "2014-02-01T12:34:12Z",
  "updated": "2014-02-02T01:23:45Z",
  "enabled": true,
  "matchers": [{
    "fieldName": "HOSTNAME",
    "operator": "STARTS_WITH",
    "value": "my-host-prefix"
  }, {
    "fieldName": "PORT",
    "operator": "EQUALS",
    "value": "27017"
  }],
  "notifications": [{
    "typeName": "GROUP",
    "intervalMin": 5,
    "delayMin": 0,
    "groupId": "2847387cd717dabc348a",
    "groupName": "test1",
    "emailEnabled": true,
    "smsEnabled": true
  }, {
    "typeName": "USER",
    "intervalMin": 5,
    "delayMin": 0,
    "username": "john.doe",
    "emailEnabled": true,
    "smsEnabled": true
  }, {
    "typeName": "SNMP",
    "intervalMin": 5,
    "delayMin": 0,
    "snmpAddress": "example.com:161"
  }, {
    "typeName": "EMAIL",
    "intervalMin": 5,
    "delayMin": 0,
    "emailAddress": "somebody@example.com"
  }, {
    "typeName": "SMS",
    "intervalMin": 5,
    "delayMin": 0,
    "mobileNumber": "(212) 212-1212"
  }, {
    "typeName": "HIP_CHAT",
    "intervalMin": 5,
    "delayMin": 0,
    "notificationToken": "123456abcdef",
    "roomName": "My Chat Room"
  }, {
    "typeName": "SLACK",
    "intervalMin": 5,
    "delayMin": 0,
    "channelName": "my-channel",
    "apiToken": "abcdef123456abcdef123456abcdef"
  }, {
    "typeName": "FLOWDOCK",
    "intervalMin": 5,
    "delayMin": 0,
    "orgName" : "my-org",
    "flowName" : "my-flow",
    "flowdockApiToken": "abcdef123456abcdef123456abcdef12"
  }, {
    "typeName": "PAGER_DUTY",
    "intervalMin": 5,
    "delayMin": 0,
    "serviceKey": "123456abcdef"
  }],
  "metricThreshold": {
    "metricName": "MEMORY_RESIDENT",
    "operator": "GREATER_THAN",
    "threshold": 7,
    "units": "GIGABYTES",
    "mode": "TOTAL"
  },
  "links": [ ... ]
}

Entity Fields

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

The type of this alert configuration. Supports the same values as the typeName field of the alerts resource.

  • HOST
  • HOST_METRIC
  • AGENT
  • BACKUP
  • GROUP
  • REPLICA_SET
  • USER
eventTypeName string

The type of event that will trigger an alert. The possible values depend on the typeName:

  • HOST alert type. Possible values:
    • HOST_DOWN
    • HOST_RECOVERING
    • VERSION_BEHIND
    • HOST_EXPOSED
  • HOST_METRIC alert type. Possible value:
    • OUTSIDE_METRIC_THRESHOLD
  • AGENT alert type. Possible values:
    • MONITORING_AGENT_DOWN
    • MONITORING_AGENT_VERSION_BEHIND
    • BACKUP_AGENT_DOWN
    • BACKUP_AGENT_VERSION_BEHIND
    • BACKUP_AGENT_CONF_CALL_FAILURE
  • BACKUP alert type. Possible values:
    • OPLOG_BEHIND
    • CLUSTER_MONGOS_IS_MISSING
    • RESYNC_REQUIRED
    • RS_BIND_ERROR
    • BACKUP_TOO_MANY_RETRIES
    • BACKUP_IN_UNEXPECTED_STATE
    • LATE_SNAPSHOT
    • BAD_CLUSTERSHOTS
    • SYNC_SLICE_HAS_NOT_PROGRESSED
  • GROUP alert type. Possible values:
    • USERS_AWAITING_APPROVAL
    • USERS_WITHOUT_MULTI_FACTOR_AUTH
  • REPLICA_SET alert type. Possible values:
    • CONFIGURATION_CHANGED
    • PRIMARY_ELECTED
    • TOO_FEW_HEALTHY_MEMBERS
    • TOO_MANY_UNHEALTHY_MEMBERS
    • NO_PRIMARY
  • USER alert type. Possible values:``
    • JOINED_GROUP
    • REMOVED_FROM_GROUP
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.
matchers.fieldName string

The name of the field in the target object to match on. The available fields depend on the typeName:

  • AGENT - None.
  • BACKUP - None.
  • HOST and HOST_METRIC - Possible values are:
    • HOSTNAME
    • PORT
    • HOSTNAME_AND_PORT
    • REPLICA_SET_NAME
    • TYPE_NAME
  • REPLICA_SET - Possible values are:
    • REPLICA_SET_NAME
    • SHARD_NAME
    • CLUSTER_NAME
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. When matching on the TYPE_NAME field for a HOST or HOST_METRIC alert, the possible typeName values are:

  • 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
  • SNMP (Only available to Ops Manager installations)
  • EMAIL
  • SMS (Only available to MongoDB Cloud Manager installations)
  • HIPCHAT
  • SLACK
  • FLOWDOCK
  • PAGER_DUTY
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.groupID string ID of the group to which to send the notification.
notifications.groupName string Name of the group to which to send the 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 an Ops 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.snmpAddress string Hostname and port to send SNMP traps to. At this time Ops Manager is only able to send SNMP traps to the standard SNMP port (161). Only present for SNMP notifications. Ops Manager uses SNMP v2c.
notifications.emailAddress string The email address to which to send notification. Only present for notifications of type EMAIL.
notifications.notificationToken string A HipChat API token. Only present for notifications of type HIP_CHAT.
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.
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 as it appears in the “flow email address” setting in Flowdock. For example: flowname@example.flowdock.com.
notifications.flowdockApiToken string The Flowdock “personal API token.” Only present for FLOWDOCK notifications.
notifications.serviceKey string PagerDuty service key. Only present for PAGER_DUTY notifications.
metricThreshold object The threshold that will cause an alert to be triggered. Only present for alerts of the HOST_METRIC.
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

The mode to use when computing the current metric value. Possible values are:

  • AVERAGE
  • TOTAL

Examples

Get All Alert Configurations in a Group

curl -u "username:apiKey" --digest -i "https://cloud.mongodb.com/api/public/v1.0/groups/5196d3628d022db4cbc26d9e/alertConfigs"

HTTP/1.1 200 OK

{
  "totalCount": 3,
  "results": [ {
    "id" : "5271259ee4b00ece6b4754ef",
    "groupId" : "5196d3628d022db4cbc26d9e",
    "typeName" : "BACKUP",
    "eventTypeName" : "RESYNC_REQUIRED",
    "created" : "2013-10-30T15:28:30Z",
    "updated" : "2014-02-12T16:11:05Z",
    "enabled" : true,
    "matchers" : [ ],
    "notifications" : [ {
      "typeName" : "EMAIL",
      "intervalMin" : 60,
      "delayMin" : 0,
      "emailAddress" : "somebody@example.com"
    } ],
    "links" : [ ... ]
  }, {
    "id" : "5329c8dfe4b0b07a83d67e7e",
    "groupId" : "5196d3628d022db4cbc26d9e",
    "typeName" : "AGENT",
    "eventTypeName" : "MONITORING_AGENT_DOWN",
    "created" : "2014-03-19T16:42:07Z",
    "updated" : "2014-03-19T16:42:07Z",
    "enabled" : true,
    "matchers" : [ ],
    "notifications" : [ {
      "typeName" : "GROUP",
      "intervalMin" : 5,
      "delayMin" : 0,
      "emailEnabled" : true,
      "smsEnabled" : false
    } ],
    "links" : [ ... ]
  }, {
    "id" : "533dc40ae4b00835ff81eaee",
    "groupId" : "5196d3628d022db4cbc26d9e",
    "typeName" : "HOST_METRIC",
    "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD",
    "created" : "2014-04-03T20:26:50Z",
    "updated" : "2014-04-03T20:26:50Z",
    "enabled" : true,
    "matchers" : [ {
      "field" : "hostnameAndPort",
      "operator" : "EQUALS",
      "value" : "mongo.example.com:27017"
    } ],
    "notifications" : [ {
      "typeName" : "SMS",
      "intervalMin" : 5,
      "delayMin" : 0,
      "mobileNumber" : "2343454567"
    } ],
    "metricThreshold" : {
      "metricName" : "ASSERT_REGULAR",
      "operator" : "LESS_THAN",
      "threshold" : 99.0,
      "units" : "RAW",
      "mode" : "AVERAGE"
    },
    "links" : [ ... ]
  } ]
}

Get an Alert Configuration

curl -u "username:apiKey" --digest -i "https://cloud.mongodb.com/api/public/v1.0/groups/5196d3628d022db4cbc26d9e/alertConfigs/533dc40ae4b00835ff81eaee"

HTTP/1.1 200 OK

{
  "id" : "533dc40ae4b00835ff81eaee",
  "groupId" : "5196d3628d022db4cbc26d9e",
  "typeName" : "HOST_METRIC",
  "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD",
  "created" : "2014-04-03T20:26:50Z",
  "updated" : "2014-04-03T20:26:50Z",
  "enabled" : true,
  "matchers" : [ {
    "field" : "hostnameAndPort",
    "operator" : "EQUALS",
    "value" : "mongo.example.com:27017"
  } ],
  "notifications" : [ {
    "typeName" : "SMS",
    "intervalMin" : 5,
    "delayMin" : 0,
    "mobileNumber" : "2343454567"
  } ],
  "metricThreshold" : {
    "metricName" : "ASSERT_REGULAR",
    "operator" : "LESS_THAN",
    "threshold" : 99.0,
    "units" : "RAW",
    "mode" : "AVERAGE"
  },
  "links" : [ ... ]
}

Get All Open Alerts Triggered by an Alert Configuration

curl -u "username:apiKey" --digest -i "https://cloud.mongodb.com/api/public/v1.0/groups/5196d3628d022db4cbc26d9e/alertConfigs/533dc40ae4b00835ff81eaee/alerts"

HTTP/1.1 200 OK

{
  "totalCount" : 2,
  "results" : [ {
    "id" : "53569159300495c7702ee3a3",
    "groupId" : "4d1b6314e528c81a1f200e03",
    "typeName" : "HOST_METRIC",
    "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD",
    "status" : "OPEN",
    "acknowledgedUntil" : "2014-05-01T14:00:00Z",
    "created" : "2014-04-22T15:57:13.562Z",
    "updated" : "2014-04-22T20:14:11.388Z",
    "lastNotified" : "2014-04-22T15:57:24.126Z",
    "metricName" : "ASSERT_REGULAR",
    "currentValue" : {
      "number" : 0.0,
      "units" : "RAW"
    },
    "links" : [ ... ]
  }, {
    "id" : "5356ca0e300495c770333340",
    "groupId" : "4d1b6314e528c81a1f200e03",
    "typeName" : "HOST_METRIC",
    "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD",
    "status" : "OPEN",
    "created" : "2014-04-22T19:59:10.657Z",
    "updated" : "2014-04-22T20:14:11.388Z",
    "lastNotified" : "2014-04-22T20:14:19.313Z",
    "metricName" : "ASSERT_REGULAR",
    "currentValue" : {
      "number" : 0.0,
      "units" : "RAW"
    },
    "links" : [ ... ]
  } ],
  "links" : [ ... ]
}

Create a New Alert Configuration

curl -i -u "username:apiKey" -H "Content-Type: application/json" --digest -X POST "https://cloud.mongodb.com/api/public/v1.0/groups/4d1b6314e528c81a1f200e03/alertConfigs" --data '
{
  "groupId" : "4d1b6314e528c81a1f200e03",
  "typeName" : "REPLICA_SET",
  "eventTypeName" : "RESYNC_REQUIRED",
  "enabled" : true,
  "notifications" : [ {
    "typeName" : "GROUP",
    "intervalMin" : 5,
    "delayMin" : 0,
    "smsEnabled" : false,
    "emailEnabled" : true
  } ]
}'

HTTP/1.1 201 Created
Location: https://cloud.mongodb.com/api/public/v1.0/groups/4d1b6314e528c81a1f200e03/alertConfigs/5357ce3e3004d83bd9c7864c

{
  "id" : "5357ce3e3004d83bd9c7864c",
  "groupId" : "4d1b6314e528c81a1f200e03",
  "typeName" : "REPLICA_SET",
  "created" : "2014-04-23T14:29:18Z",
  "updated" : "2014-04-23T14:29:18Z",
  "enabled" : true,
  "matchers" : [ ],
  "notifications" : [ {
    "typeName" : "GROUP",
    "intervalMin" : 5,
    "delayMin" : 0,
    "emailEnabled" : true,
    "smsEnabled" : false
  } ],
  "links" : [ ... ]
}

Update an Existing Alert Configuration

curl -i -u "username:apiKey" -H "Content-Type: application/json" --digest -X PUT "https://cloud.mongodb.com/api/public/v1.0/groups/4d1b6314e528c81a1f200e03/alertConfigs/5357ce3e3004d83bd9c7864c" --data '
{
  "groupId" : "4d1b6314e528c81a1f200e03",
  "typeName" : "REPLICA_SET",
  "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
  } ]
}'

HTTP/1.1 200 OK

{
  "id" : "5357ce3e3004d83bd9c7864c",
  "groupId" : "4d1b6314e528c81a1f200e03",
  "typeName" : "REPLICA_SET",
  "created" : "2014-04-23T14:52:29Z",
  "updated" : "2014-04-23T14:52:29Z",
  "enabled" : true,
  "matchers" : [ {
    "fieldName" : "REPLICA_SET_NAME",
    "operator" : "EQUALS",
    "value" : "rs1"
  } ],
  "notifications" : [ {
    "typeName" : "EMAIL",
    "intervalMin" : 60,
    "delayMin" : 5,
    "emailAddress" : "sos@example.com"
  }, {
    "typeName" : "GROUP",
    "intervalMin" : 120,
    "delayMin" : 60,
    "emailEnabled" : false,
    "smsEnabled" : true
  } ],
  "links" : [ ... ]
}

Disable an Alert Configuration

curl -i -u "username:apiKey" -H "Content-Type: application/json" --digest -X PATCH "https://cloud.mongodb.com/api/public/v1.0/groups/4d1b6314e528c81a1f200e03/alertConfigs/5357ce3e3004d83bd9c7864c" --data '
{
  "enabled" : false
}'

HTTP/1.1 200 OK

{
  "id" : "5357ce3e3004d83bd9c7864c",
  "groupId" : "4d1b6314e528c81a1f200e03",
  "typeName" : "REPLICA_SET",
  "created" : "2014-04-23T14:52:29Z",
  "updated" : "2014-04-23T14:56:25Z",
  "enabled" : false,
  "matchers" : [ {
    "fieldName" : "REPLICA_SET_NAME",
    "operator" : "EQUALS",
    "value" : "rs1"
  } ],
  "notifications" : [ {
    "typeName" : "EMAIL",
    "intervalMin" : 60,
    "delayMin" : 5,
    "emailAddress" : "sos@example.com"
  }, {
    "typeName" : "GROUP",
    "intervalMin" : 120,
    "delayMin" : 60,
    "emailEnabled" : false,
    "smsEnabled" : true
  } ],
  "links" : [ ... ]
}

Delete an Alert Configuration

curl -i -u "username:apiKey" --digest -X DELETE "https://cloud.mongodb.com/api/public/v1.0/groups/4d1b6314e528c81a1f200e03/alertConfigs/5357ce3e3004d83bd9c7864c"

HTTP/1.1 200 OK