Custom metrics (Disk-space-utilization) is missing on the AWS console

Viewed 1127

I want to create a cloudwatch alarm for the diskspace-utilization. I've folowed the AWS doc below

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

It is creating the cron on my instance and I've checked my system log as well.

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)

also manually running the command,

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

shows the result,

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

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

But there is no metrics in the aws console, So that I can set the alarm,

Please help, If someone solved the problem.

1 Answers

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.

Related