Navigation

Global Alert Configurations

The globalAlertConfigs resource retrieves and updates alert configurations for global alerts.

Endpoints

Get All Global Alert Configurations

GET /api/public/v1.0/globalAlertConfigs

Get a Specific Global Alert Configuration

GET /api/public/v1.0/globalAlertConfigs/GLOBAL-ALERT-CONFIG-ID

Get All Open Alerts Triggered by a Global Alert Configuration

GET /api/public/v1.0/globalAlertConfigs/GLOBAL-ALERT-CONFIG-ID/alerts

Create a Global Alert Configuration

POST /api/public/v1.0/globalAlertConfigs

The following fields are required:

  • eventTypeName
  • notifications
  • forAllGroups

The metricThreshold field is required if eventTypeName is set to OUTSIDE_METRIC_THRESHOLD.

The threshold field is required if eventTypeName is set to either of the following:

  • TOO_FEW_HEALTHY_MEMBERS
  • TOO_MANY_UNHEALTHY_MEMBERS

To enable the global alert configuration, set the enabled field to true.

Important

If the enabled field is not specified, Ops Manager sets its value to false by default, and the global alert configuration is not enabled.

Update a Global 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 a Global Alert Configuration.

PUT /api/public/v1.0/globalAlertConfigs/GLOBAL-ALERT-CONFIG-ID

Enable or Disable a Global Alert Configuration

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

PATCH /api/public/v1.0/globalAlertConfigs/GLOBAL-ALERT-CONFIG-ID

Delete a Global Alert Configuration

DELETE /api/public/v1.0/globalAlertConfigs/GLOBAL-ALERT-CONFIG-ID

Sample Entity

The following is an example return document.

{
  "id" : "56a104e0e4b00664f588acbc",
  "groupIds" : [ ],
  "created" : "2016-05-17T20:20:34Z",
  "enabled" : true,
  "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD",
  "forAllGroups" : true,
  "matchers" : [ ],
  "notifications" : [ {
    "delayMin" : 0,
    "intervalMin" : 5,
    "typeName": "EMAIL",
    "emailAddress": "admin@example.com"
    } ],
  "metricThreshold" : {
    "metricName" : "OPCOUNTER_CMD",
    "mode" : "AVERAGE",
    "operator" : "LESS_THAN",
    "threshold" : 100.0,
    "units" : "RAW"
    },
  "tags" : [ ],
  "typeName" : "HOST_METRIC",
  "updated" : "2016-08-24T20:25:36Z",
  "links" : [ ... ]
}

Entity Fields

Name Type Description
id string A unique identifier for the global alert configuration.
groupIds array of strings The IDs of the groups the configuration applies to. This field applies only if forAllGroups is set to false.
created date When the global alert configuration was created.
enabled boolean Specifies whether the global alert configuration is enabled.
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
    • RS_BIND_ERROR (x alerts only)
    • BACKUP_TOO_MANY_RETRIES (global alerts only)
    • BACKUP_IN_UNEXPECTED_STATE (global alerts only)
    • LATE_SNAPSHOT (global alerts only)
    • SYNC_SLICE_HAS_NOT_PROGRESSED (global alerts only)
    • BACKUP_JOB_TOO_BUSY (global alerts only)
    • GROUP_TAGS_CHANGED (global alerts only)
  • 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
forAllGroups boolean

Selects whether the global alert configuration applies to all groups. Also affects whether you can use the tags array to target the configuration to specific groups.

If you set this to true, the configuration applies to all groups. You can target the configuration to specific groups through the tags array.

If set to false, the configuration applies only to the groups specified in the groupIds array, and you must specify at least one group in the groupIds array. You cannot use the tags array for this configuration.

matchers array of objects

Rules to apply when matching an object against this global 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 array of objects Notifications to send when an alert condition is detected.
notifications.delayMin number The number of minutes to wait after an alert condition is detected before sending out the first notification.
notifications.intervalMin number The number of minutes to wait between successive notifications for unacknowledged alerts that are not resolved.
notifications.typeName string

The type of alert notification. Possible values are:

  • ADMIN
  • GROUP
  • USER
  • SNMP
  • EMAIL
  • SMS (Available only if Ops Manager is configured for Twilio integration.)
  • HIPCHAT
  • SLACK
  • FLOWDOCK
  • PAGER_DUTY
notifications.emailEnabled boolean Specifies whether email notifications should be sent. Only present for notifications of type GROUP and USER.
notifications.smsEnabled boolean Specifies whether SMS notifications should be sent. Only present for notifications of type GROUP and USER.
notifications.username string The name of the Ops Manager user to whom to send notifications. 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 (162). 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. If the token later becomes invalid, Ops 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, Ops 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, Ops 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, Ops 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 globalAlerts resource. For a list of values, see Measurement Types for Global Alerts.
metricThreshold.mode string This is set to AVERAGE and computes the current metric value as an average.
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
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.
tags array of strings The alert configuration applies only to groups with all the specified tags.
typeName string This field is deprecated and will be ignored.
updated date When this global alert configuration was last updated.

Examples

Get All Global Alert Configurations

Request

curl -i -u "username:apiKey" --digest "https://<ops-manager-host>/api/public/v1.0/globalAlertConfigs"

Response

HTTP/1.1 200 OK

{
  "results" : [ {
    "created" : "2016-01-21T16:18:40Z",
    "enabled" : false,
    "eventTypeName" : "BACKUP_AGENT_DOWN",
    "forAllGroups" : true,
    "groupIds" : [ ],
    "id" : "56a104e0e4b00664f588acbc",
    "links" : [ ... ],
    "matchers" : [ ],
    "notifications" : [ {
      "delayMin" : 60,
      "intervalMin" : 60,
      "typeName" : "ADMIN"
    } ],
    "tags" : [ ],
    "typeName" : "AGENT",
    "updated" : "2016-01-28T03:53:30Z"
  }, ... ],
  "links" : [ ... ],
  "totalCount" : 16
}

Get a Specific Global Alert Configuration

Request

curl -i -u "username:apiKey" --digest "https://<ops-manager-host>/api/public/v1.0/globalAlertConfigs/578c023ae4b08e7209a5d5ac"

Response

HTTP/1.1 200 OK

{
  "created" : "2016-07-17T22:10:02Z",
  "enabled" : true,
  "eventTypeName" : "TOO_MANY_UNHEALTHY_MEMBERS",
  "forAllGroups" : true,
  "groupIds" : [ ],
  "id" : "578c023ae4b08e7209a5d5ac",
  "matchers" : [ ],
  "notifications" : [ {
    "delayMin" : 60,
    "emailAddress" : "sos@example.com",
    "intervalMin" : 60,
    "typeName" : "EMAIL"
  } ],
  "tags" : [ ],
  "threshold" : {
    "operator" : "GREATER_THAN",
    "threshold" : 0
  },
  "typeName" : "REPLICA_SET",
  "updated" : "2016-08-17T20:42:26Z",
  "links" : [ ... ]
}

Get All Open Alerts Triggered by a Global Alert Configuration

Request

curl -i -u "username:apiKey" --digest "https://<ops-manager-host>/api/public/v1.0/globalAlertConfigs/56a104e0e4b00664f588acb9/alerts"

Response

HTTP/1.1 200 OK

{
  "results" : [ {
    "alertConfigId" : "56a104e0e4b00664f588acb9",
    "created" : "2016-10-22T15:57:24.126Z",
    "eventTypeName" : "LATE_SNAPSHOT",
    "groupId" : "5729fde7e4a0132d250fed5f",
    "id" : "572ca2ebe4b069bc2c56f1a",
    "lastNotified" : "2016-10-22T15:57:24.126Z",
    "replicaSetName" : "replicaSet-shard-0",
    "sourceTypeName" : "REPLICA_SET",
    "status" : "OPEN",
    "tags" : [ ],
    "updated" : "2016-10-22T15:57:24.126Z"
  } ],
  "links" : [ ... ],
  "totalCount" : 1
}

Create a New Global Alert Configuration

Request

 curl -i -u "username:apiKey" --digest -H "Content-Type: application/json" -X POST "https://<ops-manager-host>/api/public/v1.0/globalAlertConfigs" --data '
 {
   "eventTypeName" : "CLUSTER_MONGOS_IS_MISSING",
   "enabled" : true,
   "forAllGroups" : true,
   "groupIds" : [ ],
   "notifications" : [ {
     "delayMin" : 0,
     "emailAddress" : "sos@example.net",
     "intervalMin" : 60,
     "typeName" : "EMAIL"
   } ],
   "tags" : [ ]
}

Response

HTTP/1.1 201 Created

{
  "id" : "57046eebe4b08c698b25f458",
  "created" : "2016-10-26T02:05:31Z",
  "enabled" : true,
  "eventTypeName" : "CLUSTER_MONGOS_IS_MISSING",
  "forAllGroups" : true,
  "groupIds" : [ ],
  "matchers" : [ ],
  "notifications" : [ {
    "delayMin" : 0,
    "emailAddress" : "sos@example.net",
    "intervalMin" : 60,
    "typeName" : "EMAIL"
  } ],
  "tags" : [ ],
  "typeName" : "CLUSTER",
  "updated" : "2016-10-26T02:05:31Z",
  "links" : [ ... ]
}

Update an Existing Alert Configuration

Request

curl -i -u "username:apiKey" --digest -H "Content-Type: application/json" -X PUT "https://<ops-manager-host>/api/public/v1.0/globalAlertConfigs/57046eebe4b08c698b25f458" --data '
{
  "eventTypeName" : "CLUSTER_MONGOS_IS_MISSING",
  "enabled" : true,
  "forAllGroups" : true,
  "groupIds" : [ ],
  "matchers" : [ ],
  "notifications" : [ {
    "delayMin" : 0,
    "emailAddress" : "sos@example.net",
    "intervalMin" : 60,
    "typeName" : "EMAIL"
  }, {
    "delayMin" : 5,
    "emailAddress" : "admin@example.net",
    "intervalMin" : 30,
    "typeName" : "EMAIL"
  } ],
  "tags" : [ "production" ],
  "typeName" : "CLUSTER"
}

Response

HTTP/1.1 200 OK
{
  "id" : "57046eebe4b08c698b25f458",
  "created" : "2016-10-26T02:05:31Z",
  "enabled" : true,
  "eventTypeName" : "CLUSTER_MONGOS_IS_MISSING",
  "forAllGroups" : true,
  "groupIds" : [ ],
  "matchers" : [ ],
  "notifications" : [ {
    "delayMin" : 0,
    "emailAddress" : "sos@example.net",
    "intervalMin" : 60,
    "typeName" : "EMAIL"
  }, {
    "delayMin" : 5,
    "emailAddress" : "admin@example.net",
    "intervalMin" : 30,
    "typeName" : "EMAIL"
  } ],
  "tags" : [ "production" ],
  "typeName" : "CLUSTER",
  "updated" : "2016-11-02T03:03:22Z",
  "links" : [ ... ]
}

Disable a Global Alert Configuration

Request

curl -i -u "username:apiKey" --digest -H "Content-Type: application/json" -X PUT "https://<ops-manager-host>/api/public/v1.0/globalAlertConfigs/57046eebe4b08c698b25f458" --data '
{
  "enabled" : false
}'

Response

HTTP/1.1 200 OK

{
  "id" : "57046eebe4b08c698b25f458",
  "created" : "2016-10-26T02:05:31Z",
  "enabled" : false,
  "eventTypeName" : "CLUSTER_MONGOS_IS_MISSING",
  "forAllGroups" : true,
  "groupIds" : [ ],
  "matchers" : [ ],
  "notifications" : [ {
    "delayMin" : 0,
    "emailAddress" : "sos@example.net",
    "intervalMin" : 60,
    "typeName" : "EMAIL"
  }, {
    "delayMin" : 5,
    "emailAddress" : "admin@example.net",
    "intervalMin" : 30,
    "typeName" : "EMAIL"
  } ],
  "tags" : [ "production" ],
  "typeName" : "CLUSTER",
  "updated" : "2016-11-04T18:14:09Z",
  "links" : [ ... ]
}

Delete a Global Alert Configuration

Request

curl -i -u "username:apiKey" --digest -X DELETE "https://<ops-manager-host>/api/public/v1.0/alertConfigs/57046eebe4b08c698b25f458"

Response

HTTP/1.1 200 OK

{}