寻求帮助, 我无法使用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>
任何人都知道这里出了什么问题?我想数据可能,但我没有任何线索做正确的。 :(
答案 0 :(得分:0)
问题在于数据。这应该有效:
{
"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"
}