AWS控制台

时间:2017-09-22 12:26:48

标签: amazon-web-services amazon-cloudwatch

我想为磁盘空间利用率创建一个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-脚本纹/ 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(邮寄1个字节的输出;但得到状态0x004b,#012)

还手动运行命令

  

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

显示结果,

  

在CloudWatchClient.pm第167行关闭文件句柄MDATA上打印()。

     

成功向CloudWatch报告指标。参考ID:####

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

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

1 个答案:

答案 0 :(得分:4)

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.

This is the support answer that I get from the aws support on having the same issue may be it will help u too. Also do check your AWSAccessKey for the EC2 instance as well.

相关问题