2017-01-19 70 views

回答

1

好吧發現瞭如何:

基本上只是使用相同的任務,剩下的端點,並做了後,並通過在JSON。 在json中,你可以指定templateId和下面的變量。

{ 
 
"status": "disabled" 
 
,"id": "test_task4" 
 
,"template-id": "generic_mean_alert" 
 
,"vars" : { 
 
    "measurement": {"type" : "string", "value" : "cpu" }, 
 
    "where_filter": {"type": "lambda", "value": "\"cpu\" == 'cpu-total'"}, 
 
    "groups": {"type": "list", "value": [{"type":"string", "value":"host"},{"type":"string", "value":"dc"}]}, 
 
    "field": {"type" : "string", "value" : "usage_idle" }, 
 
    "warn": {"type" : "lambda", "value" : "\"mean\" < 30.0" }, 
 
    "crit": {"type" : "lambda", "value" : "\"mean\" < 10.0" }, 
 
    "window": {"type" : "duration", "value" : "1m" }, 
 
    "slack_channel": {"type" : "string", "value" : "#alerts_testing" } 
 
} 
 
,"dbrps": [ { "db": "test","rp": "autogen" } ] 
 
,"type": "stream" 
 
}

http://yoururl/kapacitor/v1/tasks