全部文档
当前文档

暂无内容

如果没有找到您期望的内容,请尝试其他搜索词

文档中心

ModifyLogPolicy

最近更新时间:2023-03-30 11:36:36

接口描述

用于修改告警策略,需要至少修改一项有效内容。

请求参数

该接口无特有请求头。获取更多信息,请参见公共请求头
参数详情具体如下表。

参数名称 类型 是否必须 描述
id Integer 策略id
name String 告警名称
projectName String 工程名称
dashboardId String 仪表盘id
dashboardName String 仪表盘名称
queries List 查询
condition String 触发条件
scheduleType Long 频率类型:0:间隔时间 4:cron
fixInterval String 间隔时间
cronExpr String 频率为cron的表达式
notifyInterval Long 通知间隔
notifyThreshold Long 触发次数阈值
enabled Integer 是否启用 0:不启用 1: 启用
channelParam Map 报警渠道配置

querie字段说明:

参数名称 类型 描述
logPoolName String 日志池名称
graphName String 图表名称
start String 查开始区间
end String 查询结束区间
query String 查询语句

channelParam字段说明:

参数名称 类型 描述
usrgrpId Integer 告警接收组id,需要在云监控查询
channelType Integer 报警类型 1:邮件 2: 短信 3:邮件和短信
emailContent String 邮件报警内容格式
smsContent String 短信报警内容格式

响应参数

参数详情具体如下表。

参数名称 类型 描述
status Integer 状态码
message String 状态信息

示例

请求示例

PUT /ModifyLogPolicy HTTP/1.1
Authorization: <AuthorizationString>
x-klog-api-version: 0.1.0
Host:klog.api.ksyun.com
x-klog-signature-method: hmac-sha1
Date: <GMT Date>
Content-Type: application/json
Content-MD5: <Content-MD5>
Content-Length: <ContentLength>
Connection: Keep-Alive
{
  "name": "1111",
  "projectName": "test1111",
  "dashboardId": 231,
  "dashboradName": "test",
  "queries": [
    {
      "logPoolName": "asdasd",
      "graphId": 201,
      "graphName": "ttt",
      "start": "-60s",
      "end": "now",
      "query": "SELECT *"
    }
  ],
  "condition": "$0.c>0",
  "scheduleType": 0,
  "fixInterval": "1m",
  "notifyInterval": 86400,
  "notifyThreshold": 1,
  "channelParam": {
    "usrgrpId": 1276,
    "channelType": 1,
    "emailContent": "${project},${condition}${alertname}"
  },
  "enabled": 1,
  "id": 271
}

响应示例

HTTP/1.1 200
Server: nginx
Content-Length: 0
Connection: close
Access-Control-Allow-Origin: *
Date: Sun, 27 May 2018 07:43:27 GMT
x-klog-requestid: 5B0A619F205DC3F30EDA9322
{
    "status": 0,
    "message": "成功",
}
文档导读
纯净模式常规模式

纯净模式

点击可全屏预览文档内容
文档反馈