Alerting profiles API - POST a profile
Creates a new alerting profile.
The request consumes and produces an application/json
payload.
This request is an Early Adopter release and may be changed in non-compatible way.
POST |
|
Authentication
To execute this request, you need the Write configuration (WriteConfig
) permission assigned to your API token. To learn how to obtain and use it, see Tokens and authentication.
Parameters
The body must not provide an ID. An ID is assigned automatically by the Dynatrace server.
Parameter | Type | Description | In | Required |
---|---|---|---|---|
body | AlertingProfile |
The JSON body of the request. Contains parameters of the new alerting profile. |
body | optional |
Body format
The AlertingProfile object
Configuration of an alerting profile.
Element | Type | Description | Required |
---|---|---|---|
metadata | ConfigurationMetadata | optional | |
id | string |
The ID of the alerting profile. |
optional |
displayName | string |
The name of the alerting profile, displayed in the UI. |
required |
rules | AlertingProfileSeverityRule[] |
A list of severity rules. The rules are evaluated from top to bottom. The first matching rule applies and further evaluation stops. If you specify both severity rule and event filter, the AND logic applies. |
optional |
mzId | string |
The ID of the management zone to which the alerting profile applies. |
optional |
eventTypeFilters | AlertingEventTypeFilter[] |
The list of event filters. For all filters that are negated inside of these event filters, that is all "Predefined" as well as "Custom" (Title and/or Description) ones the AND logic applies. For all non-negated ones the OR logic applies. Between these two groups, negated and non-negated, the AND logic applies. If you specify both severity rule and event filter, the AND logic applies. |
optional |
The AlertingEventTypeFilter object
Configuration of the event filter for the alerting profile.
You have two mutually exclusive options:
- Select an event type from the list of the predefined events. Specify it in the predefinedEventFilter field.
- Set a rule for custom events. Specify it in the customEventFilter field.
Element | Type | Description | Required |
---|---|---|---|
predefinedEventFilter | AlertingPredefinedEventFilter | optional | |
customEventFilter | AlertingCustomEventFilter | optional |
The AlertingCustomEventFilter object
Configuration of a custom event filter.
Filters custom events by title or description. If both specified, the AND logic applies.
Element | Type | Description | Required |
---|---|---|---|
customTitleFilter | AlertingCustomTextFilter | optional | |
customDescriptionFilter | AlertingCustomTextFilter | optional |
The AlertingCustomTextFilter object
Configuration of a matching filter.
Element | Type | Description | Required |
---|---|---|---|
enabled | boolean |
The filter is enabled ( |
required |
value | string |
The value to compare to. |
required |
operator | string |
Operator of the comparison. You can reverse it by setting negate to |
required |
negate | boolean |
Reverses the comparison operator. For example it turns the begins with into does not begin with. |
required |
caseInsensitive | boolean |
The condition is case sensitive ( If not set, then |
required |
The AlertingPredefinedEventFilter object
Configuration of a predefined event filter.
Element | Type | Description | Required |
---|---|---|---|
eventType | string |
The type of the predefined event. |
required |
negate | boolean |
The alert triggers when the problem of specified severity arises while the specified event is happening ( For example, if you chose the Slowdown ( Consider the following use case as an example. The Slowdown (
|
required |
The AlertingProfileSeverityRule object
A severity rule of the alerting profile.
A severity rule defines the level of severity that must be met before an alert is sent our for a detected problem. Additionally it restricts the alerting to certain monitored entities.
Element | Type | Description | Required |
---|---|---|---|
severityLevel | string |
The severity level to trigger the alert. |
required |
tagFilter | AlertingProfileTagFilter | required | |
delayInMinutes | integer |
Send a notification if a problem remains open longer than X minutes. |
required |
The AlertingProfileTagFilter object
Configuration of the tag filtering of the alerting profile.
Element | Type | Description | Required |
---|---|---|---|
includeMode | string |
The filtering mode:
|
required |
tagFilters | TagFilter[] |
A list of required tags. |
optional |
The TagFilter object
A tag-based filter of monitored entities.
Element | Type | Description | Required |
---|---|---|---|
context | string |
The origin of the tag, such as AWS or Cloud Foundry. Custom tags use the |
required |
key | string |
The key of the tag. Custom tags have the tag value here. |
required |
value | string |
The value of the tag. Not applicable to custom tags. |
optional |
The ConfigurationMetadata object
Metadata useful for debugging
Element | Type | Description | Required |
---|---|---|---|
configurationVersions | integer[] |
A Sorted list of the version numbers of the configuration. |
optional |
currentConfigurationVersions | string[] |
A Sorted list of string version numbers of the configuration. |
optional |
clusterVersion | string |
Dynatrace server version. |
optional |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request. See the Example expandable section for working sample request.
{
"id": "12345678-abcd-1234-abcd-1234567890ab",
"displayName": "sampleAlertingProfile",
"mzId": "1",
"rules": [
{
"severityLevel": "AVAILABILITY",
"tagFilter": {
"includeMode": "INCLUDE_ALL",
"tagFilters": [
{
"context": "AWS",
"key": "tagKey",
"value": "tagValue"
}
]
},
"delayInMinutes": 60
}
],
"eventTypeFilters": [
{
"predefinedEventFilter": {
"eventType": "OSI_HIGH_CPU",
"negate": true
}
},
{
"customEventFilter": {
"customTitleFilter": {
"enabled": true,
"value": "filterValue",
"operator": "EQUALS",
"negate": false,
"caseInsensitive": true
},
"customDescriptionFilter": {
"enabled": false,
"value": "filterValue",
"operator": "CONTAINS",
"negate": true,
"caseInsensitive": false
}
}
}
]
}
Response
Response codes
Code | Description |
---|---|
201 | Success. The new alerting profile has been created. The response contains the ID of the new alerting profile. |
400 | Failed. The input is invalid. |
Response body
The EntityShortRepresentation object
The short representation of a Dynatrace entity.
Element | Type | Description |
---|---|---|
id | string | The ID of the Dynatrace entity. |
name | string | The name of the Dynatrace entity. |
description | string | A short description of the Dynatrace entity. |
{
"id": "6a98d7bc-abb9-44f8-ae6a-73e68e71812a",
"name": "Dynatrace entity",
"description": "Dynatrace entity for the REST API example\n"
}
Validate payload
We recommend that you validate the payload before submitting it with an actual request. A response code of 204 indicates a valid payload.
The request consumes an application/json
payload.
This request is an Early Adopter release and may be changed in non-compatible way.
POST |
|
Authentication
To execute this request, you need the Write configuration (WriteConfig
) permission assigned to your API token. To learn how to obtain and use it, see Tokens and authentication.
Response
Response codes
Code | Description |
---|---|
204 | Validated. The submitted alerting profile is valid. Response doesn't have a body |
400 | Failed. The input is invalid. |
Response body
A successful request doesn't return any content.
Example
In this example, the request creates a new alerting profile with the following parameters:
- Severity level: Availability, triggers after 2 minutes
- Applies to monitored entities with MainApp tag.
- Triggers when the Browser monitor global outage event is occurring.
The API token is passed in the Authorization header.
Because the request body is lengthy, it is truncated in this example Curl section. See the full body in the Request body section. You can download or copy the example request body to try it out on your own. Before using it, make sure that you're using tags that are available in your environment.
Curl
curl -X POST \
https://mySampleEnv.live.dynatrace.com/api/config/v1/alertingProfiles \
-H 'Authorization: Api-token abcdefjhij1234567890' \
-H 'Content-Type: application/json' \
-d '{<truncated - see the Request body section >}'
Request URL
https://mySampleEnv.live.dynatrace.com/api/config/v1/alertingProfiles
Request body
{
"displayName": "App availability",
"rules": [
{
"severityLevel": "AVAILABILITY",
"tagFilter": {
"includeMode": "INCLUDE_ANY",
"tagFilters": [
{
"context": "CONTEXTLESS",
"key": "MainApp"
}
]
},
"delayInMinutes": 2
}
],
"managementZoneId": 9130632296508575249,
"eventTypeFilters": [
{
"predefinedEventFilter": {
"eventType": "SYNTHETIC_GLOBAL_OUTAGE",
"negate": false
}
}
]
}
Response body
{
"id": "19e50c27-8aed-408f-ad44-d6a1bf856f49",
"name": "App availability"
}
Response code
201
Result
The new alerting profile looks like this in the UI: