Navigation

Get All Alert Configurations for a Project

Note

Groups and projects are synonymous terms. Your {GROUP-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://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0

Resource

GET /groups/{PROJECT-ID}/alertConfigs

Request Path Parameters

All request path parameters are required.

Parameter Type Description
PROJECT-ID string Unique identifier for this Project.

Request Query Parameters

This endpoint may use any of the HTTP request query parameters available to all Ops Manager API resources. These are all optional.

Name Type Description Default
pageNum integer Page number (1-based). 1
itemsPerPage integer Maximum number of items to return, up to a maximum of 100. 100
pretty boolean Indicates whether the response body should be in a prettyprint format. false
envelope boolean

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 a list of results, the results object is an envelope. Ops Manager adds the status field to the response body.

false

Request Body Parameters

This endpoint does not use HTTP request body parameters.

Response

Response Document

The response JSON document includes an array of result objects, an array of link objects and a count of the total number of result objects retrieved.

Name Type Description
results object array This array includes one object for each item detailed in the results Embedded Document section.
links object array This array includes one or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification.
totalCount number The count of the total number of items in the result set. It may be greater than the number of objects in the results array if the entire result set is paginated.

results Embedded Document

Each result is one alert configuration.

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.

  • 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)
  • Project 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
groupId string Unique identifier of the Project that owns this alert configuration.
id string Unique identifier for this alert configuration.
matchers.fieldName string

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

Operator to test the field’s value. Accepted values are:

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

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
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 matchers array only when the eventTypeName specifies an event for a host, replica set, or sharded cluster.

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

Operator to apply when checking the current metric value against the threshold value. Accepted values are:

  • GREATER_THAN
  • LESS_THAN
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.

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:

  • RAW
  • BITS
  • BYTES
  • KILOBITS
  • KILOBYTES
  • MEGABITS
  • MEGABYTES
  • GIGABITS
  • GIGABYTES
  • TERABYTES
  • PETABYTES
  • MILLISECONDS
  • SECONDS
  • MINUTES
  • HOURS
  • DAYS
metricThreshold object Threshold that will cause an alert to be triggered. Populated if "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD".
notifications.apiToken string Slack API token or Bot token. Populated for SLACK notifications. If the token later becomes invalid, Ops Manager sends an email to the Project owner and eventually removes the token.
notifications.channelName string Slack channel name. Populated for SLACK notifications.
notifications.datadogApiKey string DataDog API Key. Found in the DataDog dashboard. Populated for DATADOG notifications.
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. Populated for EMAIL notifications.
notifications.emailEnabled boolean Flag indicating email notifications must be sent. Populated for GROUP and USER notifications.
notifications.flowdockApiToken string Flowdock “personal API token.” Populated for FLOWDOCK notifications. If the token later becomes invalid, Ops Manager sends an email to the Project owner and eventually removes the token.
notifications.flowName string Flow name, in lower-case letters. Populated for FLOWDOCK notifications. The flow name appears after the organization name in the URL string: www.flowdock.com/app/<organization-name>/<flow-name>.
notifications.intervalMin number Number of minutes to wait between successive notifications for unacknowledged alerts that are not resolved.
notifications.notificationToken string HipChat API token. Populated for HIP_CHAT notifications. If the token later becomes invalid, Ops Manager sends an email to the Project owner and eventually removes the token.
notifications.orgName string Flowdock organization name in lower-case letters. This is the name that appears after www.flowdock.com/app/ in the URL string. Populated for FLOWDOCK notifications.
notifications.role string Ops Manager role in current Project. Populated for GROUP notifications.
notifications.roomName string HipChat room name. Populated for HIP_CHAT notifications.
notifications.serviceKey string PagerDuty service key. Populated for PAGER_DUTY notifications. If the key later becomes invalid, Ops Manager sends an email to the Project owner and eventually removes the key.
notifications.smsEnabled boolean Flag indicating SMS notifications must be sent. Populated for GROUP and USER notifications.
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). Populated for SNMP notifications. Ops Manager uses SNMP v2c.
notifications.typeName string

Type of alert notification. Accepted values are:

  • DATADOG
  • EMAIL
  • FLOWDOCK
  • GROUP
  • HIPCHAT
  • PAGER_DUTY
  • SLACK
  • SMS (Twilio integration must be configured)
  • SNMP
  • USER
  • WEBHOOK
notifications.username string Name of an Ops Manager user to which to send notifications. Only a user in the Project that owns the alert configuration is allowed here. Populated for USER notifications.
notifications 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.

  • GREATER_THAN
  • LESS_THAN
threshold.threshold number Threshold value outside of which an alert is triggered.
threshold object

Threshold that will cause an alert to be triggered. Populated if

  • "eventTypeName" : "TOO_FEW_HEALTHY_MEMBERS"
  • "eventTypeName" : "TOO_MANY_UNHEALTHY_MEMBERS"
typeName string This field is deprecated and are ignored.
updated string Timestamp in ISO 8601 date and time format in UTC when this alert configuration was last updated.

Example Request

curl --user '{USERNAME}:{APIKEY}' --digest \
 --header 'Accept: application/json' \
 --include \
 --request GET "https://<ops-manager-host>/api/public/v1.0/groups/{PROJECT-ID}/alertConfigs"

Example Response

Response Header

HTTP/1.1 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
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}

Response Body

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