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

Operations

GET /api/public/v1.0/groups/GROUP-ID/alertConfigs/ALERT-CONFIG-ID
  • Get a single alert configuration by ID.
GET /api/public/v1.0/groups/GROUP-ID/alertConfigs
  • Get all alert configurations for a group.
GET /api/public/v1.0/groups/GROUP-ID/alertConfigs/ALERT-CONFIG-ID/alerts
  • Get all open alerts that were triggered by an alert configuration.
POST /api/public/v1.0/groups/GROUP-ID/alertConfig
  • Create a new alert configuration. All fields are required except created and updated.
PUT /api/public/v1.0/groups/GROUP-ID/alertConfigs
  • Update an existing alert configuration. Partial updates are not supported except for one field (see PATCH below), so you must send the entire entity.
PATCH /api/public/v1.0/groups/GROUP-ID/alertConfigs/ALERT-CONFIG-ID
  • Use to enable/disable an alert configuration by setting the enabled field.
DELETE /api/public/v1.0/groups/GROUP-ID/alertConfigs/ALERT-CONFIG-ID
  • Remove an alert configuration.

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": "EMAIL",
    "intervalMin": 5,
    "delayMin": 0,
    "emailAddress": "somebody@somewhere.com"
  }, {
    "typeName": "HIP_CHAT",
    "intervalMin": 5,
    "delayMin": 0,
    "notificationToken": "123456abcdef",
    "roomName": "|mms| Test Chat Room"
  }, {
    "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": "SMS",
    "intervalMin": 5,
    "delayMin": 0,
    "mobileNumber": "(212) 212-1212"
  }, {
    "typeName": "SNMP",
    "intervalMin": 5,
    "delayMin": 0,
    "snmpAddress": "somedomain.com:161"
  }, {
    "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 enum The type of this alert configuration. Supports the same values as the typeName field of the alerts resource.
eventTypeName enum The type of event that will trigger an alert. Supports the same values as the eventTypeName field of the alerts resource.
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 - Not applicable.
  • BACKUP - Not applicable.
  • 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 enum

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 enum

The type of alert notification. Possible values are:

  • GROUP
  • USER
  • SMS (Only available to Ops Manager installations)
  • EMAIL
  • PAGER_DUTY
  • HIPCHAT
  • SNMP
notifications.delayMin integer The number of minutes to wait after an alert condition is detected before sending out the first notification.
notifications.intervalMin integer The number of minutes to wait between successive notifications for unacknowledged alerts that are not resolved.
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.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 Mobile number to send SMS messages to. Only present for notifications of type SMS.
notifications.snmpAddress string Hostname and port to send SNMP traps to. Note that SNMP is only supported for Ops Manager; also, at this time Ops Manager is only able to send SNMP traps to the standard SNMP port (161).
notifications.serviceKey string PagerDuty service key.
metricThreshold object The threshold that will cause an alert to be triggered. Only present for alerts of the HOST_METRIC.
metricThreshold.metricName enum The name of the metric to check. Supports the same values as the metricName field of the alerts resource.
metricThreshold.operator enum

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

  • GREATER_THAN
  • LESS_THAN
metricThreshold.threshold integer The threshold value outside of which an alert will be triggered.
metricThreshold.units enum The units for the threshold value. Supports the same values as the currentValue.units field of the alerts resource.
metricThreshold.mode enum

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://mms.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@somewhere.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.babypearfoo.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://mms.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.babypearfoo.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://mms.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://mms.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://mms.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://mms.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@foo.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@foo.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://mms.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@foo.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://mms.mongodb.com/api/public/v1.0/groups/4d1b6314e528c81a1f200e03/alertConfigs/5357ce3e3004d83bd9c7864c"

HTTP/1.1 200 OK