Is it possible to get the amount of free disk space (df) with CloudWatch? If so, what metric represents the free disk space?
AWS meanwhile provides their own sample scripts for monitoring memory and disk space usage on your Amazon EC2 instances running Linux at least, see New Amazon CloudWatch Monitoring Scripts:
Please note though, that many popular 3rd party monitoring solutions provide respective samples or full fledged solutions for memory and disk space usage monitoring as well already, so one usually doesn't need to reinvent the wheel. The AWS provided scripts are fairly decent and extensive as well though, i.e. they cover the use case more thorough than most custom one off scripts floating around.
No, this is not possible (yet). See the AWS staff answers on the related question cloudwatch for memory usage, which covers the reason for this as well:
I doubt that this functionality will emerge anytime soon though, as the required cross platform agent functionality is readily available from a couple of other vendors offering dedicated monitoring solutions already, and this task is all but simple - it would definitely be a huge win to have support for this built into AWS directly of course.
Here's a better version of the same script that retrieves the volumes attached to an instance and reports each volume's usage.
note the substition of /dev/xvd for /dev/sd
also note that you need the ec2-api tools and cloudwatch tools installed along with a certificate to make those work
I put together a bash script to do this using the custom cloudwatch metrics
replace XXXX with your own values
put this in a cron job, and you'll have a metric you can put alarms on. I decided to go with percentages and instance specific mount points instead of monitoring the volume itself because it suited my needs. I tend to resize and switch around volumes more than I'm restarting instances. Your mileage may vary.
Unhappy with Amazon's sample scripts or the various 3rd party scripts that use their Perl-based command-line tools, we wrote our own script in Python: aws-cloudwatch-linux-metrics.
Single file, has no dependencies, and runs on any Python interpreter.
It reads data right from the
It reports these metrics with respect to both the instance id and the image id.
Sometime after the question was asked, AWS provided scripts with options to report disk usage.
You can run this script in crontab to report available disk space to CloudWatch. Don't forget to include the disk path.
The Docs give a full list of options plus example here.