简体   繁体   English

aws php sdk返回内存数据的空数据点,该数据已从mon脚本perl放入cloudwatch

[英]aws php sdk return empty datapoint for MemoryUtilization Metric that put in cloudwatch from mon script perl

im using mon-script for retriving Memory From AWS Instances .in aws console every thing is ok but in api datapoint just return empty .it's really confusing because in boto(Python Version) every thing is ok and response correct but in php not 我使用mon-script从AWS Instances检索内存。在aws控制台中一切正常,但是在api数据点中只是返回空。这确实令人困惑,因为在boto(Python Version)中一切正常并且响应正确,但是在php中

its my code 这是我的代码

header("Content-type: text/html; charset=utf-8");
require_once '../sdk.class.php';
$cw = new AmazonCloudWatch(); 
$response = $cw->get_metric_statistics(
'System/Linux', 'MemoryUtilization',
date("c", strtotime('-5 minute')),
date("c", strtotime('now')),
300,
'Average', 
'Percent',
array('Name'=> 'InstanceId', 'Value'=>'i-8c15b124')
);

I don't know anything about PHP but does the date function you are calling return the time in UTC? 我对PHP一无所知,但是您调用的date函数是否以UTC返回时间? If it doesn't, that could be problem because the service expects the timestamps to be in UTC. 如果不是,那可能是个问题,因为该服务希望时间戳记为UTC。

它通过升级到version3 api来解决。我认为这是一个基于时间戳的问题,与php中的微秒有关

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM