通过告警id获取告警信息¶
该接口基于告警编号获取告警信息。
示例¶
请求URl
curl --location --request GET 'https://caweb.aiops.com/api/alert/rest/api/v1/alert/alarmNum' \ --user 'email@example.com:<access_token>' \ --header 'Accept: application/json'
参数说明¶
| 参数 | 类型 | 说明 |
|---|---|---|
| alarmNum | string | 必填,告警编号 |
access_token如何获取请参考文档 api令牌
提示
• 示例邮箱应替换为用户注册所用邮箱
• access_token应替换为您手动获取的access_token
• 如需对请求进行加密处理:请将
--user 'email@example.com:access_token' \
--header 'Accept: application/json'
替换为:
--header 'Authorization: Basic Z2FveWluaW5nOTk5NUAxNjMuY29tOmt1WWl6bmljZ3oxN0JBVjk=' \
--header 'Content-Type: application/json'
• 替换步骤请参考加密步骤
响应报文¶
{
"result": "success",
"message": null,
"data":
{
"id": 74546803,
"versionCol": 1,
"cid": null,
"alarmType": "event",
"alarmName": "监控项目",
"entityName": "183.84.5.255",
"hostIp": "",
"status": "ACTIVE",
"priority": 2,
"alarmContent": "监控项目 当前丢包率大于30%",
"content": null,
"createTime": 1732677798209,
"updateTime": 1732677798225,
"closeTime": null,
"entityId": "2588749",
"alertDefId": 0,
"user": "768215042",
"policyId": null,
"source": "jiankongbao",
"app": "f5c3a268ceaf428399ee1379c379b485",
"eventId": "25887492",
"sourceUrl": null,
"ext": 1,
"ackTime": null,
"ackUser": null,
"closeUser": null,
"closeComments": null,
"autoResolve": null,
"host": "",
"service": "",
"metric": "",
"tag": "",
"parentAlarmId": 4,
"alarmVersion": null,
"autoResolveTime": 1732677798225,
"isActive": null,
"activeCount": 0,
"activeAlarm": null,
"taskId": null,
"application": "",
"model": "",
"details": "",
"contexts": "",
"firstClassification": null,
"secondaryClassification": null,
"problemDescription": null,
"validStatus": 0,
"contactNames": [],
"assignObject": {},
"ackTimeL": null,
"ackUserContactName": null,
"closeUserContactName": null,
"timeDuring": "28天22小时46分42秒",
"appService":
{
"id": "2bee63eab6ca44e59a16b2c5cf6e84e0",
"escalationId": "system",
"entityId": "f5c3a268ceaf428399ee1379c379b485",
"description": "监控包",
"integrateType": "jiankongbao"
},
"labels": null,
"followed": false,
"jiraAlarmIssue":
{
"id": "e40abba2-99aa-495b-bdf2-3482559660aa",
"alarmId": 74546803,
"alarmName": "监控项目",
"alarmContent": "监控项目当前丢包率大于30%",
"self": "https://xxx.atlassian.net/browse/STBG-32",
"issueId": 10096,
"issueKey": "STBG-32",
"issueTypeId": 10006,
"issuePriority": 2,
"projectKey": "STBG",
"createTime": 1735178989275,
"projectName": "缺陷项目"
},
"appDescription": "监控宝项目",
"recommendSolution": null,
"actualSolution": "--",
"testAlarm": false,
"workName": null,
"version": 1,
"alarmDefId": 0,
"alarmId": 74546803,
"count": 1,
"creationTime": "11-27 11:23",
"creationTimeL": 1732677798209,
"modifiedTime": "11-27 11:23",
"modifiedTimeL": 1732677798225,
"closeTimeL": null,
"lastTimeTxt": "28天"
},
"totalCount": 0,
"code": 200
}
响应参数¶
| 参数 | 类型 | 说明 |
|---|---|---|
| result | string | 返回结果:success成功 、false 失败 |
| message | string | 返回消息 |
| data | 返回数据集 | |
| totalCount | int | 数据量 |
| code | int | 响应码 |
data结果集¶
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Number | 告警 ID |
| alarmName | string | 告警名称 |
| entityName | string | 关联实体名称 |
| status | String | 告警状态,例如 ACTIVE |
| priority | Number | 告警优先级4:通知;1:提醒;2:警告;3严重;5:致命 |
| alarmContent | String | 告警内容描述 |
| createTime | Timestamp | 告警创建时间(毫秒级时间戳) |
| updateTime | Timestamp | 告警更新时间(毫秒级时间戳) |
| closeTime | Timestamp | 告警关闭时间(如果未关闭则为 null) |
| source | string | 告警来源 |
| appDescription | string | 应用描述 |
| jiraAlarmIssue | Object | 关联的 JIRA 工单信息 |
| appService | Object | 应用服务详细信息 |
| timeDuring | string | 告警持续时间 |
错误响应¶
{
"result": "failed",
"message": "失败,请检查参数.",
"data": null,
"totalCount": 0,
"code": 400
}
错误响应码¶
| 错误码 | 说明 |
|---|---|
| 200 | 成功 |
| 400 | 失败,传入的参数有问题 |
| 401 | 认证失败,用户名密码错误 |
| 403 | 权限失败,用户没有权限做此操作 |
| 404 | 告警不存在 |