新增触发器
请求方式:POST
URL: http://api.heclouds.com/triggers
http body参数
参数名称 |
格式 |
是否必须 |
说明 |
title |
string |
是 |
触发器名称 |
ds_id |
string |
是 |
数据流名称 |
dev_ids |
array-string |
否 |
设备ID,缺省时默认为全部设备 |
url |
string |
是 |
告警通知地址 |
type |
string |
是 |
触发条件,见type说明列表 |
threshold |
|
是 |
触发条件门限值,与type配合使用,见type说明列表 |
type说明列表
type |
说明 |
> |
threshold必须为数值 |
< |
threshold必须为数值 |
>= |
threshold必须为数值 |
<= |
threshold必须为数值 |
inout |
threshold设置为{"lolmt":40, "uplmt":52},表示数据值进入或离开闭区间[40,52]时触发 |
change |
threshold 参数不用传递;当上传的值有改变时触发告警 |
frozen |
threshold 为数值,指定多少秒内未上报数据触发告警,同时被监控对象进入frozen状态 |
live |
threshold为数值,指定多少秒后上报数据触发告警 |
返回参数
参数名称 |
格式 |
说明 |
errno |
int |
调用错误码,为0表示调用成功 |
error |
string |
错误描述,为"succ"表示调用成功 |
data |
json |
接口调用成功之后返回的设备相关信息,见data描述表 |
data描述表
参数名称 |
格式 |
说明 |
trigger_id |
int |
触发器ID |
请求头部示例
POST http://api.heclouds.com/triggers HTTP/1.1
请求参数示例
{
"title": "trigger",
"ds_id": "gps",
"url": "http://aoic.choqf.com",
"type": ">",
"threshold": 100
}
返回示例
{
"errno":0,
"data": {
"trigger_id":123809
},
"error":"succ"
}
触发数据示例
{
"trigger": {
"id": 123809,
"threshold": 9.0,
"type": ">"
},
"current_data": [{
"dev_id": "2656",
"ds_id": "gps",
"ds_uuid": "FWEF-ZFW-ZFW-ZFWW",
"at": "2009-09-07T12:16:02.001403Z",
"value": 100
}
]
}