amazon-web-services – AWS控制台上缺少自定义指标(磁盘空间利用率)

我想为磁盘空间利用创建一个cloudwatch警报.
我已经在下面的AWS文档中提到过了

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html

它正在我的实例上创建cron,我也检查了我的系统日志.

Sep 22 12:20:01 ip-#### CRON[13921]: (ubuntu) CMD
(~/volumeAlarm/aws-scripts-mon/mon-put-instance-data.pl
–disk-space-util –disk-space-avail –disk-space-used –disk-path=/ –from-cron)

Sep 22 12:20:13 ip-#### CRON[13920]: (ubuntu) MAIL (mailed 1 byte of output; but got status 0x004b, #012)

还手动运行命令,

./mon-put-instance-data.pl –disk-space-util –disk-space-avail
–disk-space-used –disk-path=/

显示结果,

print() on closed filehandle MDATA at CloudWatchClient.pm line 167.

Successfully reported metrics to CloudWatch. Reference Id:####

但是aws控制台中没有指标,所以我可以设置警报,

请帮忙,如果有人解决了这个问题.

最佳答案

CloudWatch scripts will get the instance’s meta data and write it to a
local file /var/tmp/aws-mon/instance-id, if the file or folder has
incorrect permission that the script cannot write to file
/var/tmp/aws-mon/instance-id, then it may throw error like “print() on
closed filehandle MDATA at CloudWatchClient.pm line 167”. Sorry for
making assumption. A possible scenario is: the root user executed the
mon-get-instance-stats.pl or mon-put-instance-data.pl scripts
initially, and the scripts has generated the file/folder on place,
then the root user switched back to different user and execute the
CloudWatch scripts again, this error shows up. To fix this, you need
to remove the folder /var/tmp/aws-mon/, and re-execute the CloudWatch
scripts to re-generate the folder and files again.

这是我从aws支持获得相同问题的支持答案可能对你也有帮助.另外,请检查您的AWSAccessKey以获取EC2实例.

转载注明原文:amazon-web-services – AWS控制台上缺少自定义指标(磁盘空间利用率) - 代码日志