【问题标题】:What is openstack ceilometer alarm creation error "Missing argument: \"data\""什么是 openstack ceilometer 警报创建错误“缺少参数:\”data\“”
【发布时间】:2016-03-03 04:26:06
【问题描述】:

我遇到了这个错误:

*{"error_message": {"debuginfo": null, "faultcode": "Client", "faultstring":    "Missing argument: \"data\""}}*

我正在 php 中进行其余的调用以创建警报

$json = '\'{"alarm_actions": ["log:///tmp/tst.txt"], "description":  " Test of CPU usage high", "threshold_rule": {"meter_name": "cpu_usage_high", "evaluation_periods": 2, "period": 10, "statistic": "avg", "threshold": 40.0,"query":[{"field": "resource_id", "type": "", "value": "500a1594-4972-7968-2914-c333201585bd", "op": "eq"}], "comparison_operator": "gt" }, "repeat_actions": "FALSE", "type": "threshold", "name": "cpu_high_alarm_ada_9007"}\'';

$result = json_decode ($json);

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,$headers );
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,$result);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);


$result     = curl_exec($curl);

【问题讨论】:

    标签: php codeigniter rest openstack ceilometer


    【解决方案1】:

    要检查 json 的有效性,请使用online json validator.

    在这里,我在 json 数据中发送 "False"(带引号)。但服务器期待数据 false(不带引号)。

    【讨论】:

      猜你喜欢
      • 2012-03-04
      • 2013-06-23
      • 2020-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多