调用 DescribeAlarms 接口获取告警策略。
此接口的调用频率限制为 20 次/s,超出频率限制会报错 ExceedQPSLimit。
下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。
参数 | 参数类型 | 是否必选 | 示例值 | 说明 |
---|---|---|---|---|
ProjectId | String | 可选 | p***** | 告警策略所属的日志项目 ID。 |
AlarmName | String | 可选 | test-alarm-nofify | 告警策略名称。 |
AlarmId | String | 可选 | a***** | 告警策略 ID。 |
TopicId | String | 可选 | t****** | 监控对象的日志主题 ID。 |
TopicName | String | 可选 | newtopic | 监控对象的日志主题名称。 |
Status | Boolean | 可选 | true | 是否开启告警策略。 |
PageNumber | Integer | 可选 | 1 | 分页查询时的页码。默认为 1,即从第一页数据开始返回。 |
PageSize | Integer | 可选 | 20 | 分页大小。默认为 20,最大为 100。 |
下表仅列出本接口特有的返回参数。更多信息请参见返回结构。
参数 | 参数类型 | 示例值 | 说明 |
---|---|---|---|
Alarms | Array of AlarmInfo | / | 告警策略列表。详细信息请参考 AlarmInfo。 |
Total | Integer | 5 | 符合条件的告警策略总数。 |
GET https://tls-{Region}.ivolces.com/DescribeAlarms?ProjectId=e4**** HTTP/1.1 ...
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 ... { "Total": 1, "Alarms": [ { "AlarmId": "7626228d-b813-42f4-86e5-84d6c3******", "AlarmName": "test", "ProjectId": "e4052889-4189-456e-88a4-6a6cf8******", "Status": true, "QueryRequest": [ { "Query": "Failed | select count(*) as errNum", "Number": 1, "TopicId": "29374d88-52ea-4184-9ce0-0250b3******", "TopicName": "test3", "StartTimeOffset": -120, "EndTimeOffset": 0 } ], "RequestCycle": { "Type": "Period", "Time": 60 }, "Condition": "$1.errNum>0", "TriggerPeriod": 1, "AlarmPeriodDetail":{ "SMS":10, "Phone":10, "Email":2, "GeneralWebhook":3 }, "AlarmNotifyGroup": [ { "AlarmNotifyGroupName": "test1", "AlarmNotifyGroupId": "9f5db662-2aa4-42b5-ae82-9c0593******", "NotifyType": [ "Recovery", "Trigger" ], "Receivers": [ { "ReceiverType": "User", "ReceiverNames": [ "*******" ], "ReceiverChannels": [ "Sms" ], "StartTime": "00:00:00", "EndTime": "23:59:59" } ], "CreateTime": "2022-04-21 06:48:56", "ModifyTime": "2022-04-21 06:48:56" } ], "UserDefineMsg": "test", "CreateTime": "2022-04-21 06:49:41", "ModifyTime": "2022-04-21 06:50:57" } ] }
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。
错误码(Code) | HTTP 状态码 | 错误信息(Message) | 说明 |
---|---|---|---|
InvalidArgument | 400 | Invalid argument key %s, value %s, please check argument. | 参数不合法。 |
AlarmNotExist | 404 | Alarm xxx does not exist | 告警策略不存在。 |
InternalServerError | 500 | We encountered an unexpected server error . Please try again later. | 服务器内部错误。 |