請求方式:POST
URL: http://api.onenet.hk.chinamobile.com/triggers
參數名稱 | 格式 | 是否必須 | 說明 |
---|---|---|---|
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 |
P0ST http://api.onenet.hk.chinamobile.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
}
]
}