Create One Global Alert Configuration
On this page
Create one global alert configuration.
Required Roles
You can successfully call this endpoint with any of the following assigned roles:
Request
Base URL: https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0
POST /globalAlertConfigs
Request Path Parameters
This endpoint doesn't use HTTP request body parameters.
Request Query Parameters
Name | Type | Necessity | Description | Default | ||||||
---|---|---|---|---|---|---|---|---|---|---|
pretty | boolean | Optional | Flag indicating whether the response body should be in a prettyprint format. |
| ||||||
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:
|
|
Request Body Parameters
Body Parameter | Type | Necessity | Description |
---|---|---|---|
| boolean | Optional | Toggle that specifies whether the alert configuration is enabled. |
| 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. |
| boolean | Required | Toggle that specifies whether the global alert configuration
applies to all groups. Also affects whether you can use the
If If |
| array of strings | Optional | IDs of the groups to which this alert configuration applies.
This field applies only if |
| 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 .fieldName | string | Conditional | Name of the field in the target object on which to match.
All other types of alerts do not support matchers. |
matchers .operator | string | Conditional | Operator to test the field's value. Accepted values are:
|
matchers .value | string | Conditional | Value to test with the specified operator. If
|
| object | Conditional | Threshold that causes this alert configuration to trigger
an alert. Only required if |
metricThreshold .metricName | string | Conditional | Name of the metric to check. Supports the same values as the
|
metricThreshold .mode | string | Conditional | This is set to |
metricThreshold .operator | string | Conditional | Operator to apply when checking the current metric value
against
|
metricThreshold .threshold | number | Conditional | Threshold value outside of which this alert configuration triggers an alert. |
metricThreshold .units | string | Conditional | Units for Accepted values are:
For example, a metric that measures memory consumption can use |
| 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 |
notifications .channelName | string | Conditional | Slack channel name. Only accepted for |
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
|
notifications .emailEnabled | boolean | Conditional | Toggle specifying whether Ops Manager sends email notifications.
Only accepted for |
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:
You can configure a To explicitly declare a |
notifications .webhookUrl | string | Optional | URL for the webhook that triggers this notification. If you do
not explicitly declare a |
notifications .microsoftTeamsWebhookUrl | string | Conditional | Microsoft Teams channel incoming webhook URL. Only accepted
for |
notifications .notificationToken | string | Conditional | HipChat API token. Only accepted for |
notifications .roomName | string | Conditional | HipChat room name. Only accepted for |
notifications .serviceKey | string | Conditional | PagerDuty integration key. Only accepted for All new PagerDuty keys use their Events API v2. If you have an Events API v1 key, you can continue to use that key with Ops Manager. |
notifications .smsEnabled | boolean | Conditional | Toggle specifying whether Ops Manager sends SMS notifications. Only
accepted for |
notifications .typeName | string | Required | Type of alert notification this alert configuration triggers. Accepted values are:
|
notifications .username | string | Conditional | Name of the Ops Manager user to whom to send notifications. Only
present for |
| object | Conditional | Threshold that causes this alert configuration to trigger
an alert. Only required if
|
threshold .operator | string | Conditional | Operator to apply when checking the current metric value against
|
threshold .threshold | number | Conditional | Threshold value outside of which this alert configuration triggers an alert. |
| array of strings | Optional | Tags associated with this alert configuration. |
| string | Optional | This field is deprecated and will be ignored. |
Response
Name | Type | Description |
---|---|---|
| string | Timestamp in ISO 8601 date and time format in UTC when the alert configuration was created. |
| boolean | Toggle that specifies whether the alert configuration is enabled. |
| 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. |
| boolean | Toggle that specifies whether the global alert configuration
applies to all groups. Also affects whether you can use the
If If |
| array of strings | IDs of the groups to which this alert configuration applies.
This field applies only if |
| string | Unique identifier of the alert configuration. |
| 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 |
| string | Name of the field in the target object on which to match.
All other types of alerts do not support matchers. |
| string | Operator to test the field's value. Possible values are:
|
| string | Value to test with the specified operator. If
|
| object | Threshold that causes this alert configuration to trigger
an alert. Only present if |
| string | Name of the metric to check. Supports the same values as the
|
| string | This is set to |
| string | Operator to apply when checking the current metric value
against
|
| number | Threshold value outside of which this alert configuration triggers an alert. |
| string | Units for Accepted values are:
For example, a metric that measures memory consumption can use |
| array of objects | Notifications Ops Manager sends when it detects an alert that this alert configuration describes. |
| string | Slack API token or Bot token. Only present for After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
|
| string | Slack channel name. Only present for |
| number | Number of minutes to wait after an alert condition is detected before Ops Manager sends out the first notification. |
| string | Email address to which to send notification. Only present for
|
| boolean | Toggle specifying whether Ops Manager sends email notifications.
Only present for |
| 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
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
After creating a webhook notification, the URL is partially redacted when you view or edit the alert, and the secret is completely redacted. |
| string | Microsoft Teams channel incoming webhook URL. Only present
for When you view or edit the alert for a webhook notification, the URL appears partially redacted, and the secret appears completely redacted. |
| string | HipChat API token. Only present for After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
|
| string | HipChat room name. Only present for |
| string | PagerDuty integration key. Only present for After you create a third-party integration that requires an API or integration key, the key appears partially redacted when you:
|
| boolean | Toggle specifying whether Ops Manager sends SMS notifications. Only
present for |
| string | Type of alert notification this alert configuration triggers. Possible values are:
|
| string | Name of the Ops Manager user to whom to send notifications. Only
present for |
| object | Threshold that causes this alert configuration to trigger
an alert. Only present if
|
| string | Operator to apply when checking the current metric value against
|
| number | Threshold value outside of which this alert configuration triggers an alert. |
| array of strings | Tags associated with this alert configuration. |
| string | This field is deprecated and will be ignored. |
| string | Timestamp in ISO 8601 date and time format in UTC when this alert configuration was last updated. |
Example Request
1 curl --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 }
Example Response
Response Header
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
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}
Response Body
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 }