# 报警日志
# 获取报警概况
# 请求 URL:
http://host:port/heycloud/api/logs/alert/summary
# 请求方式:
- GET
# 请求 Header:
字段 | 类型 | 是否必选 | 说明 |
---|---|---|---|
x-heycloud-admin-session | String | 是 | 通过 session 提供管理权限 |
# 请求示例:
GET http://host:port/heycloud/api/logs/alert/summary
# 正确响应示例:
{
"result": {
"firingCountInDay": 0,
"resolvedCountInDay": 0,
"unnotifiedCountInDay": 0
}
}
# 错误响应示例:
{
"error": "Error",
"message": "错误信息"
}
# 查询报警日志
# 请求 URL:
http://host:port/heycloud/api/logs/alert/query
# 请求方式:
- POST
# 请求 Header:
字段 | 类型 | 是否必选 | 说明 |
---|---|---|---|
x-heycloud-admin-session | String | 是 | 通过 session 提供管理权限 |
# 请求参数:
参数名称 | 类型 | 是否必须 | 默认值 | 说明 |
---|---|---|---|---|
where | String | 否 | - | 查询的条件 |
sortField | String | 否 | createdAt | 排序的字段 |
sortType | String | 否 | desc | 排序的类型 |
offset | Number | 否 | - | 返回结果的偏移量,用于分页 |
limit | Number | 否 | - | 返回结果的数量,用于分页 |
# 请求示例:
POST http://host:port/heycloud/api/logs/alert/query
{
"where": "\"createdAt\" > '2020-12-14T04:37:03.815Z'",
"sortField": "createdAt",
"sortType": "desc",
"offset": 0,
"limit": 11
}
# 正确响应示例:
{
"result": [
{
"id": "8202a709-00e3-45a8-809e-4379422eedb9",
"type": "prom",
"data": {
"endsAt": "0001-01-01T00:00:00Z",
"labels": { "job": "api", "name": "io", "monitor": "heycloud", "instance": "http://heycloud-io-api:9005/", "alertname": "api-health" },
"status": "firing",
"startsAt": "2021-03-05T08:28:24.43814723Z",
"annotations": { "summary": "/io API 健康监控", "description": "/io API 可用性不到 80% (报警值为 0.00%)" },
"fingerprint": "434f608a50db556f",
"generatorURL": "http://7e22b2f838a7:9090/graph?g0.expr=avg_over_time%28probe_success%5B5m%5D%29+%2A+100+%3C+80&g0.tab=1"
},
"notifiedAt": null,
"createdAt": "2021-03-05T08:28:54.664Z"
}
]
}
# 错误响应示例:
{
"error": "Error",
"message": "错误信息"
}
# 丢弃过期数据
# 请求 URL:
http://host:port/heycloud/api/logs/alert/drop
# 请求方式:
- POST
# 请求 Header:
字段 | 类型 | 是否必选 | 说明 |
---|---|---|---|
x-heycloud-admin-session | String | 是 | 通过 session 提供管理权限 |
# 请求参数:
参数名称 | 类型 | 是否必须 | 默认值 | 说明 |
---|---|---|---|---|
interval | String | 否 | 3 months | 时间间隔 |
# 请求示例:
POST http://host:port/heycloud/api/logs/alert/drop
{
interval: '30 days';
}
# 正确响应示例:
{
"result": {
"interval": "xxxx",
"droppedAt": "2021-02-04T09:46:34.465Z"
}
}
# 错误响应示例:
{
"error": "Error",
"message": "错误信息"
}