Docs Menu
Docs Home
/
MongoDB Ops Manager
/ / / /

Create One Global Alert Configuration

On this page

  • Required Roles
  • Request
  • Request Path Parameters
  • Request Query Parameters
  • Request Body Parameters
  • Response
  • Example Request
  • Example Response
  • Response Header
  • Response Body

Create one global alert configuration.

You can successfully call this endpoint with any of the following assigned roles:

Base URL: https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0

POST /globalAlertConfigs

This endpoint doesn't use HTTP request body parameters.

Name
Type
Necessity
Description
Default
pretty
boolean
Optional
Flag indicating whether the response body should be in a prettyprint format.
false
envelope
boolean
Optional

Flag that 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 one result, the response body includes:

Name
Description
status
HTTP response code
envelope
Expected response body
false
Body Parameter
Type
Necessity
Description
enabled
boolean
Optional
Toggle that specifies whether the alert configuration is enabled.
eventTypeName
string
Required

Type of event for which this alert configuration triggers an alert.

To review the types of events that generate alerts, see Alert Types.

For a complete list of events included in the Ops Manager audit log, see Audit Events.

forAllGroups
boolean
Required

Toggle that specifies 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 true, the configuration applies to all groups. You can target the alert configuration to specific groups through the tags array.

If false, the configuration applies only to the groups specified in the groupIds array. You must specify at least one project in the groupIds array. You can't use the tags array for this alert configuration.

groupIds
array of strings
Optional
IDs of the groups to which this alert configuration applies. This field applies only if forAllGroups is set to false.
matchers
array of objects
Conditional

Rules to apply when matching an object against this global alert configuration. Ops Manager only checks entities that match all these rules 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
Conditional

Name of the field in the target object on which to match.

  • 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
Conditional

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

  • EQUALS

  • NOT_EQUALS

  • CONTAINS

  • NOT_CONTAINS

  • STARTS_WITH

  • ENDS_WITH

  • REGEX

matchers
.value
string
Conditional

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

metricThreshold
object
Conditional
Threshold that causes this alert configuration to trigger an alert. Only required if eventTypeName is set to OUTSIDE_METRIC_THRESHOLD.
metricThreshold
.metricName
string
Conditional
Name of the metric to check. Supports the same values as the metricName field of the globalAlerts resource. For a list of possible values, see Measurement Types for Global Alerts.
metricThreshold
.mode
string
Conditional
This is set to AVERAGE and computes the current metric value as an average.
metricThreshold
.operator
string
Conditional

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

  • GREATER_THAN

  • LESS_THAN

metricThreshold
.threshold
number
Conditional
Threshold value outside of which this alert configuration triggers an alert.
metricThreshold
.units
string
Conditional

Units for metricThreshold.threshold. The units depend on the type of metric.

Accepted values are:

  • RAW

  • BITS

  • BYTES

  • KILOBITS

  • KILOBYTES

  • MEGABITS

  • MEGABYTES

  • GIGABITS

  • GIGABYTES

  • TERABYTES

  • PETABYTES

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

For example, a metric that measures memory consumption can use BYTES, while a metric that measures time can use HOURS.

notifications
array of objects
Required
Notifications Ops Manager sends when it detects an alert that this alert configuration describes.
notifications
.apiToken
string
Conditional
Slack API token or Bot token. Only accepted for SLACK notifications. If the token later becomes invalid, Ops Manager sends an email to the project owner and removes the token.
notifications
.channelName
string
Conditional
Slack channel name. Only accepted for SLACK notifications.
notifications
.delayMin
number
Conditional
Number of minutes to wait after an alert condition is detected before Ops Manager sends out the first notification.
notifications
.emailAddress
Conditional
Optional
Email address to which to send notification. Only accepted for EMAIL notifications.
notifications
.emailEnabled
boolean
Conditional
Toggle specifying whether Ops Manager sends email notifications. Only accepted for GROUP and USER notifications.
notifications
.intervalMin
number
Conditional
Number of minutes to wait between successive notifications for unacknowledged, unresolved alerts that this alert configuration triggers.
notifications
.webhookSecret
string
Conditional

A value used to authenticate with the Webhook that accepts and forwards the notification. You can explicitly declare a secret only in a request that has both:

  • A notifications.typeName of WEBHOOK

  • An explicitly declared notifications.webhookURL

You can configure a webhookSecret for a default webhookURL only with the Admin Console.

To explicitly declare a webhookURL without a webhookSecret, omit this field.

notifications
.webhookUrl
string
Optional
URL for the webhook that triggers this notification. If you do not explicitly declare a webhookUrl, your request will use the default webhookUrl set in the Admin Console.
notifications
.microsoftTeamsWebhookUrl
string
Conditional
Microsoft Teams channel incoming webhook URL. Only accepted for MICROSOFT_TEAMS notifications.
notifications
.notificationToken
string
Conditional
HipChat API token. Only accepted for HIP_CHAT notifications. If the token later becomes invalid, Ops Manager sends an email to the project owner and removes the token.
notifications
.roomName
string
Conditional
HipChat room name. Only accepted for HIP_CHAT notifications.
notifications
.serviceKey
string
Conditional

PagerDuty integration key. Only accepted for PAGER_DUTY notifications. If the key later becomes invalid, Ops Manager sends an email to the project owner and removes the key.

PagerDuty decommissioned their REST API v1 key in October 2018. If you have a v1 key, you can continue to use that key with Ops Manager. All new PagerDuty keys use their REST API v2, but Ops Manager does not support their v2 keys. If you don't have their REST API v1 key, use the PagerDuty Events API v1 instead.

notifications
.smsEnabled
boolean
Conditional
Toggle specifying whether Ops Manager sends SMS notifications. Only accepted for GROUP and USER notifications.
notifications
.snmpAddress
string
Conditional

Hostname and port to send SNMP traps to. At this time Ops Manager can send SNMP traps only to the standard SNMP port (162). Only accepted for SNMP notifications.

Important

Ops Manager 6.0.0 deprecates SNMP alerts. Ops Manager 7.0.0 will not include SNMP alerts. To learn more about other alert options, see Third-Party Service Integrations.

Note

Ops Manager uses SNMP v2c.

notifications
.typeName
string
Required

Type of alert notification this alert configuration triggers. Accepted values are:

  • ADMIN

  • GROUP

  • USER

  • SNMP

    Important

    Ops Manager 6.0.0 deprecates SNMP alerts. Ops Manager 7.0.0 will not include SNMP alerts. To learn more about other alert options, see Third-Party Service Integrations.

  • EMAIL

  • SMS (Available only if Ops Manager is configured for Twilio integration.)

  • HIPCHAT

  • SLACK

  • PAGER_DUTY

notifications
.username
string
Conditional
Name of the Ops Manager user to whom to send notifications. Only present for USER notifications.
threshold
object
Conditional

Threshold that causes this alert configuration to trigger an alert. Only required if eventTypeName is set to one of the following values:

  • TOO_FEW_HEALTHY_MEMBERS

  • TOO_MANY_UNHEALTHY_MEMBERS

threshold
.operator
string
Conditional

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

  • GREATER_THAN

  • LESS_THAN

threshold
.threshold
number
Conditional
Threshold value outside of which this alert configuration triggers an alert.
tags
array of strings
Optional
Tags associated with this alert configuration.
typeName
string
Optional
This field is deprecated and will be ignored.
Name
Type
Description
created
string
Timestamp in ISO 8601 date and time format in UTC when the alert configuration was created.
enabled
boolean
Toggle that specifies whether the alert configuration is enabled.
eventTypeName
string

Type of event for which this alert configuration triggers an alert.

To review the types of events that generate alerts, see Alert Types.

For a complete list of events included in the Ops Manager audit log, see Audit Events.

forAllGroups
boolean

Toggle that specifies 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 true, the configuration applies to all groups. You can target the alert configuration to specific groups through the tags array.

If false, the configuration applies only to the groups specified in the groupIds array. You must specify at least one project in the groupIds array. You can't use the tags array for this alert configuration.

groupIds
array of strings
IDs of the groups to which this alert configuration applies. This field applies only if forAllGroups is set to false.
id
string
Unique identifier of the alert configuration.
matchers
array of objects

Rules to apply when matching an object against this global alert configuration. Ops Manager only checks entities that match all these rules 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

Name of the field in the target object on which to match.

  • 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. Possible 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

metricThreshold
object
Threshold that causes this alert configuration to trigger an alert. Only present if eventTypeName is set to OUTSIDE_METRIC_THRESHOLD.
metricThreshold.metricName
string
Name of the metric to check. Supports the same values as the metricName field of the globalAlerts resource. For a list of possible 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

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

  • GREATER_THAN

  • LESS_THAN

metricThreshold.threshold
number
Threshold value outside of which this alert configuration triggers an alert.
metricThreshold.units
string

Units for metricThreshold.threshold. The units depend on the type of metric.

Accepted values are:

  • RAW

  • BITS

  • BYTES

  • KILOBITS

  • KILOBYTES

  • MEGABITS

  • MEGABYTES

  • GIGABITS

  • GIGABYTES

  • TERABYTES

  • PETABYTES

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

For example, a metric that measures memory consumption can use BYTES, while a metric that measures time can use HOURS.

notifications
array of objects
Notifications Ops Manager sends when it detects an alert that this alert configuration describes.
notifications.apiToken
string

Slack API token or Bot token. Only present for SLACK notifications. If the token later becomes invalid, Ops Manager sends an email to the project owner and removes the token.

After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:

  • View or edit the alert through the UI.

  • Query the third-party integration settings through the API.

notifications.channelName
string
Slack channel name. Only present for SLACK notifications.
notifications.delayMin
number
Number of minutes to wait after an alert condition is detected before Ops Manager sends out the first notification.
notifications.emailAddress
string
Email address to which to send notification. Only present for EMAIL notifications.
notifications.emailEnabled
boolean
Toggle specifying whether Ops Manager sends email notifications. Only present for GROUP and USER notifications.
notifications.intervalMin
number
Number of minutes to wait between successive notifications for unacknowledged, unresolved alerts that this alert configuration triggers.
notifications.[n]
.webhookSecret
string

A value used to authenticate with the Webhook that accepts and forwards the notification.

Ops Manager returns this value if you set notifications.[n].typeName to WEBHOOK and either:

  • You set notification.[n].webhookSecret to a non-empty string

  • You set a default webhookSecret on the Admin Console.

After creating a webhook notification, the URL is partially redacted when you view or edit the alert, and the secret is completely redacted.

notifications.[n]
.webhookUrl
string

URL for the webhook that triggers this notification.

Ops Manager returns this value if you set notifications.[n].typeName to WEBHOOK and either:

  • You set notification.[n].webhookURL to a non-empty string

  • You set a default webhookUrl on the Admin Console page.

After creating a webhook notification, the URL is partially redacted when you view or edit the alert, and the secret is completely redacted.

notifications.microsoftTeamsWebhookUrl
string

Microsoft Teams channel incoming webhook URL. Only present for MICROSOFT_TEAMS notifications.

When you view or edit the alert for a webhook notification, the URL appears partially redacted, and the secret appears completely redacted.

notifications.notificationToken
string

HipChat API token. Only present for HIP_CHAT notifications. If the token later becomes invalid, Ops Manager sends an email to the project owner and removes the token.

After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:

  • View or edit the alert through the UI.

  • Query the third-party integration settings through the API.

notifications.roomName
string
HipChat room name. Only present for HIP_CHAT notifications.
notifications.serviceKey
string

PagerDuty integration key. Only present for PAGER_DUTY notifications. If the key later becomes invalid, Ops Manager sends an email to the project owner and removes the key.

After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:

  • View or edit the alert through the UI.

  • Query the third-party integration settings through the API.

notifications.smsEnabled
boolean
Toggle specifying whether Ops Manager sends SMS notifications. Only present for GROUP and USER notifications.
notifications.snmpAddress
string

Hostname and port to send SNMP traps to. At this time Ops Manager can send SNMP traps only to the standard SNMP port (162). Only present for SNMP notifications.

Important

Ops Manager 6.0.0 deprecates SNMP alerts. Ops Manager 7.0.0 will not include SNMP alerts. To learn more about other alert options, see Third-Party Service Integrations.

Note

Ops Manager uses SNMP v2c.

notifications.typeName
string

Type of alert notification this alert configuration triggers. Possible values are:

  • ADMIN

  • GROUP

  • USER

  • SNMP

    Important

    Ops Manager 6.0.0 deprecates SNMP alerts. Ops Manager 7.0.0 will not include SNMP alerts. To learn more about other alert options, see Third-Party Service Integrations.

  • EMAIL

  • SMS (Available only if Ops Manager is configured for Twilio integration.)

  • HIPCHAT

  • SLACK

  • PAGER_DUTY

notifications.username
string
Name of the Ops Manager user to whom to send notifications. Only present for USER notifications.
threshold
object

Threshold that causes this alert configuration to trigger an alert. Only present if eventTypeName is set to one of the following values:

  • TOO_FEW_HEALTHY_MEMBERS

  • TOO_MANY_UNHEALTHY_MEMBERS

threshold.operator
string

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

  • GREATER_THAN

  • LESS_THAN

threshold.threshold
number
Threshold value outside of which this alert configuration triggers an alert.
tags
array of strings
Tags associated with this alert configuration.
typeName
string
This field is deprecated and will be ignored.
updated
string
Timestamp in ISO 8601 date and time format in UTC when this alert configuration was last updated.
1curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
2 --header "Accept: application/json" \
3 --header "Content-Type: application/json" \
4 --include \
5 --request POST "https://<OpsManagerHost>:<Port>/api/public/v1.0/globalAlertConfigs \
6 --data '{
7 "enabled": true,
8 "eventTypeName": "BACKUP_AGENT_DOWN",
9 "forAllGroups": true,
10 "groupIds": [],
11 "matchers": [],
12 "notifications": [
13 {
14 "delayMin": 0,
15 "intervalMin": 60,
16 "typeName": "ADMIN"
17 }
18 ],
19 "tags": [],
20 "typeName": "AGENT"
21 }
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 201 Created
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}
X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
1{
2 "created": "2019-10-02T12:34:04Z",
3 "enabled": true,
4 "eventTypeName": "BACKUP_AGENT_DOWN",
5 "forAllGroups": true,
6 "groupIds": [],
7 "id": "{GLOBAL-ALERT-CONFIG-ID}",
8 "links": [
9 ],
10 "matchers": [],
11 "notifications": [
12 {
13 "delayMin": 0,
14 "intervalMin": 60,
15 "typeName": "ADMIN"
16 }
17 ],
18 "tags": [],
19 "typeName": "AGENT",
20 "updated": "2019-10-02T12:34:04Z"
21}

Back

Get One Global Alert Configuration