Alert Event
title: "Alert Event"
description: "Flashduty Alert Event API Documentation."
date: "2024-11-20T10:00:00+08:00"
url: "https://developer-en.flashcat.cloud/en/flashduty/event-api/alert-event"
Push alert events from your own system to Flashcat Cloud through standard API to achieve automated alert noise reduction.
Request Description
Push URL
POST https://api.flashcat.cloud/event/push/alert/standard
Request Parameters:
Headers:
Field | Required | Type | Description |
---|---|---|---|
Content-Type | Yes | string | Fixed value: application/json |
QueryStrings:
Field | Required | Type | Description |
---|---|---|---|
integration_key | Yes | string | Integration key for access control. Obtained after adding integration. |
Payload:
Field | Required | Type | Description |
---|---|---|---|
title_rule | Yes | string | Alert title, no more than 512 characters, will be truncated if exceeded.Supports dynamic title generation based on alert content, see Customize Incident Attributes for generation rules. |
event_status | Yes | string | Alert status. Enumeration values ( First letter capitalized ): Critical, Warning, Info, Ok. |
alert_key | Yes | string | Alert grouping basis, used to associate the occurrence and recovery of the same alert. No more than 255 characters. |
event_time | No | int64 | Alert event occurrence timestamp in seconds ; if not provided, current time will be used. |
description | No | string | Alert description, no more than 2048 characters, will be truncated if exceeded. |
labels | No | map | Alert label collection, key is label name, value is label value: 1. Both label key and value are string type, case-sensitive. 2. Label key should not exceed 128 characters, value should not exceed 2048 characters, will be truncated if exceeded.3. Maximum 50 labels. See Label Content Reference in Best PracticesExample: "resource": "171.26.23.22", "check": "api latency > 500ms" |
Response
Field Name | Required | Type | Description |
---|---|---|---|
request_id | Yes | string | Request ID for trace tracking |
error | No | Error | Error description, returned only when an error occurs |
data | No | interface{} | Data content, can be any format, refer to API definition for details |
Error:
Field Name | Required | Type | Description |
---|---|---|---|
code | Yes | string | Error code, see Code for enumeration values |
message | No | string | Error description |
Code:
Error Code | HTTP Status | Description |
---|---|---|
InvalidParameter | 400 | Parameter error |
InvalidContentType | 400 | Content-Type not supported |
MethodNotAllowed | 400 | HTTP Method not supported |
Unauthorized | 401 | Authentication failed |
AccessDenied | 403 | Authorization failed |
RequestTooFrequently | 429 | Request too frequent |
RouteNotFound | 404 | Request Method+Path not matched |
ResourceNotFound | 400 | Account hasn't purchased resource, please proceed to billing center |
NoLicense | 400 | Account has insufficient subscription license, please upgrade or purchase subscription in billing center |
InternalError | 500 | Internal or unknown error |
Request Example
Request:
curl -X POST 'https://api.flashcat.cloud/event/push/alert/standard?integration_key=$key' \
-H 'Content-Type: application/json' \
-d '{
"event_status": "Warning",
"alert_key": "64f6b9df2007be4b0bfe56f6",
"description": "cpu idle low than 20%",
"title_rule": "$cluster::$resource::$check",
"labels": {
"resource":"es.nj.01",
"check":"cpu.idle<20%",
"service": "engine",
"cluster":"nj",
"metric":"node_cpu_seconds_total"
}
}' -v
Successful response:
{
"request_id": "0ace00116215ab4ca0ec5244b8fc54b0"
}
Failed response:
{
"request_id": "0ace00116215abc0ba4e52449bd305b0",
"error": {
"code": "InvalidParameter",
"message": "integration_key is not a valid one"
}
}
Best Practices
- Send events to Flashcat Cloud when alert status changes
- When an alert recovers, send an event with status Ok to close the alert. Otherwise, the alert will remain open. If your alert system doesn't have recovery events, we recommend manually sending recovery events
- Labels are event descriptions, you should enrich label content as much as possible (specified when sending, or generated through label enhancement rules), such as:
- Alert source, like host, cluster, check or metric
- Alert ownership information, like team, owner
- Alert category information, like class (api, db, net)
Last modified: 2 个月前