POST Alerts
Create a new alert by given parameters. The 'name' parameter is mandatory. There are some optional parameters as well, but some of them could be required in specific combination with other parameters. For example:
- When the field 'emailEnabled' is set to 'true' then at least one email address should be specified in the 'emails' field.
- When the field 'webhookEnabled' is set to 'true' then at least one URL should be specified in the 'webhookURLs' field.
- When the field 'vcopsEnabled' is set to 'true' then 'vcopsResourceKindKey' field should be specified.
{
"name": "My Alert",
"info": "This is an example of a rate based alert",
"recommendation": "Some text for recommendation",
"emailEnabled": true,
"emails": "[email protected], [email protected]",
"webhookEnabled": true,
"webhookURLs": "http://username:[email protected]/webhook1 http://example.com/webhook2",
"vcopsEnabled": true,
"vcopsCriticality": "none",
"vcopsResourceKindKey": "resourceName=test-vsan-template&adapterKindKey=VMWARE&resourceKindKey=VirtualMachine&identifiers=VMEntityName::test-vsan-template$$VMEntityObjectID::vm-107$$VMEntityVCID::94a1a7ea-ff03-4c18-827a-413998b7308c",
"autoClearAlertAfterTimeout": false,
"alertType": "RATE_BASED",
"hitCount": 4,
"searchPeriod": 300000,
"hitOperator": "GREATER_THAN",
"chartQuery": "{\"query\":\"alert\",\"startTimeMillis\":1500451917374,\"endTimeMillis\":1500532872702,\"piqlFunctionGroups\":[{\"functions\":[{\"label\":\"Count\",\"value\":\"COUNT\",\"requiresField\":false,\"numericOnly\":false}],\"field\":null}],\"dateFilterPreset\":\"LAST_5_MINUTES\",\"shouldGroupByTime\":true,\"eventSortOrder\":\"DESC\",\"summarySortOrder\":\"DESC\",\"compareQueryOrderBy\":\"TREND\",\"compareQuerySortOrder\":\"DESC\",\"compareQueryOptions\":null,\"messageViewType\":\"EVENTS\",\"constraintToggle\":\"ALL\",\"piqlFunction\":{\"label\":\"Count\",\"value\":\"COUNT\",\"requiresField\":false,\"numericOnly\":false},\"piqlFunctionField\":null,\"fieldConstraints\":[],\"supplementalConstraints\":[],\"groupByFields\":[],\"extractedFields\":[]}"
}
Response Headers
Additional information about the life-cycle status of the API.
Indicates the life-cycle status of the API.
Created a new alert with the provided data
{
"id": "fc7bfcac-200c-4840-b349-b885338f03d1",
"enabled": true,
"emailEnabled": true,
"vcopsEnabled": true,
"alertType": "RATE_BASED",
"name": "Hello Alert",
"hitCount": 2,
"searchPeriod": 300000,
"searchInterval": 60000,
"emails": "[email protected], [email protected]",
"info": "This is an example of a rate based alert",
"vcopsResourceName": "local-li-wdc-li1-04",
"vcopsCriticality": "immediate",
"lastRanAt": 1497017941283,
"lastRanAtString": "2017-06-09 18:19:01.283 GMT+04:00",
"nextRunAt": 1497018241283,
"nextRunAtString": "2017-06-09 18:24:01.283 GMT+04:00",
"runCount": 7,
"lastRunTime": 800,
"totalRunTime": 946,
"lastHitTimestamp": 1497017922145,
"lastHitTimestampString": "2017-06-09 18:18:42.145 GMT+04:00",
"ownerUuid": "1f024658-8b93-4f45-ae59-4657f96a5450",
"webhookEnabled": true,
"webhookURLs": "http://example.com/webhook1 http://example.com/webhook2",
"autoClearAlertAfterTimeout": false,
"chartQuery": "{\"query\":\"\",\"startTimeMillis\":1506417301511,\"endTimeMillis\":1506423141233,\"piqlFunctionGroups\":[{\"functions\":[{\"label\":\"Count\",\"value\":\"COUNT\",\"requiresField\":false,\"numericOnly\":false}],\"field\":null}],\"dateFilterPreset\":\"LAST_5_MINUTES\",\"shouldGroupByTime\":true,\"eventSortOrder\":\"DESC\",\"summarySortOrder\":\"DESC\",\"compareQueryOrderBy\":\"TREND\",\"compareQuerySortOrder\":\"DESC\",\"compareQueryOptions\":null,\"messageViewType\":\"EVENTS\",\"constraintToggle\":\"ALL\",\"piqlFunction\":{\"label\":\"Count\",\"value\":\"COUNT\",\"requiresField\":false,\"numericOnly\":false},\"piqlFunctionField\":null,\"fieldConstraints\":[{\"internalName\":\"ibadax3fpbpwm2lfnrsf643bl5stezk7onugc4tfmq000000\",\"operator\":\"CONTAINS\",\"value\":\"lang\"},{\"internalName\":\"ibadgns7mm4domrsgq4dkllgmvstcljrgfsteljygnrdoljsgbrtszbqgq3win3bg5sxqx3gnfwgkzc7onqv6zjsmvpw433oonugc4tfmrpwe6k7mfsg22lo\",\"operator\":\"CONTAINS\",\"value\":\"run\"}],\"supplementalConstraints\":[],\"group"
}
id
enabled
alertType
name
hitCount
searchPeriod
searchInterval
info
emailEnabled
A comma-separated list of email addresses
vcopsEnabled
vcopsResourceName
vcopsCriticality
webhookEnabled
A space-separated list of URLs
lastRanAt
lastRanAtString
nextRunAt
nextRanAtString
runCount
lastRunTime
totalRunTime
lastHitTimestamp
lastHitTimestampString
ownerUuid
autoClearAlertAfterTimeout
A string of JSON format
Error trying to create an alert with incorrect parameters
{
"errorMessage": "The 'name' field is required"
}
errorMessage
The request was refused because it lacks valid authentication
credentials. This can happen if the Authorization
header
was missing, or if it contained an invalid session ID.
Obtain a new session ID and retry the request,
or make an unauthenticated request without the Authorization
header.
"Invalid session ID"
The request was refused because the session ID has
expired. Obtain a new session ID from /api/v1/sessions
.
"Login Timeout"
Internal error while processing the client request
{
"errorMessage": "The operation failed due to an internal error."
}
A message describing the error.
A code representing the type of error.
Dynamic error details, where the field name can vary depending on the request field and error code.
curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '[{}]' https://{api_host}/api/v1/alerts