[英]Not able to create alarms using openstack API
尋求幫助,我無法使用openstack API創建警報。
目前,我正在做這樣的事情:
POST請求至:
http://controllerIP:8777/v2/alarms
我還設置了標題[X-Auth-Token和Content-Type]
我發送的身體:
{
"alarm_actions" : [
"http://webhookIp/os/alarm"
],
"insufficient_data_actions" : [
"http://webhookIp/os/alarm"
],
"ok_actions" : [
"http://webhookIp/os/alarm"
],
"comparison_operator" : "gt",
"description" : "An alarm",
"evaluation_periods" : 5,
"meter_name" : "cpu_util",
"name" : "SwiftObjectAlarm",
"period" : 60,
"statistic" : "avg",
"threshold" : 3.0,
"repeat_actions" : true,
"resource_id": "ee827e6d-5ca2-475d-af5b-7fd6976e874c"
}
我收到錯誤代碼:
<error_message>
<error>
<faultcode>Client</faultcode>
<faultstring>Invalid input for field/attribute type. Value: 'None'. Mandatory field missing.</faultstring>
<debuginfo/>
</error>
</error_message>
任何人都知道這里出了什么問題嗎?? 我想也許是數據,但我沒有任何正確的線索。 :(
問題出在數據上。 這應該工作:
{
"alarm_actions" : [
"http://webhookIp/os/alarm"
],
"insufficient_data_actions" : [
"http://webhookIp/os/alarm"
],
"ok_actions" : [
"http://webhookIp/os/alarm"
],
"comparison_operator" : "gt",
"description" : "An alarm",
"evaluation_periods" : 5,
"name" : "SwiftObjectAlarm",
"period" : 60,
"statistic" : "avg",
"type" : "threshold",
"threshold_rule": {
"meter_name" : "cpu_util",
"threshold" : 3.0
},
"repeat_actions" : true,
"resource_id": "ee827e6d-5ca2-475d-af5b-7fd6976e874c"
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.