I'm a system engineer, and I'm looking for a way to make an alarm on the disk space on our Amazon EC2 cloudwatch, please advice ?
Asked
Active
Viewed 8,312 times
4
-
3This is an excellent question and something a lot of folks would like to accomplish. Even though Amazon doesn't have this built in, you can create your own metrics and alerts with CloudWatch, so a custom script would be fantastic all around. I have no idea why people are downvoting the question. – Eric Hammond Oct 18 '12 at 19:20
-
It's getting down voted for a couple of reasons IMHO. First, it's a "gimme teh codez" type question, which are frowned upon here. Second, the OP shows no evidence that he's done any research into this himself, explaining what he has tried, etc. – EEAA Oct 18 '12 at 19:54
-
I have no idea why people are downvoting the question /// Eric was correct. i do think - why people are down-voting.. – Invent Sekar Oct 18 '12 at 20:36
-
1There is a project, [AWS-Missing-Tools](https://github.com/colinbjohnson/aws-missing-tools/blob/master/ec2-write-storage-used/ec2-write-storage-used.sh) that has some of the functionality you are looking for (e.g. creating a disk-space metric on CloudWatch). You should be able to modify it to suit your needs, run it via cron, and then create an alarm once the metric is populated. – cyberx86 Oct 18 '12 at 23:41
-
This is a duplicate of ["How to get the amount of free disk space with CloudWatch?"](http://serverfault.com/a/578668/211052). – malthe Feb 27 '14 at 09:39
2 Answers
9
Amazon has provided exactly what you are looking for:
mon-put-instance-data.pl
- Collects system metrics on an Amazon EC2 instance (memory, swap, disk space utilization) and sends them to Amazon CloudWatch.http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html
Note: Somebody had posted a pointer to this as an answer here earlier, but it looks like the answer was taken down. I wish they could get credit for this answer.
I'll also pull the aws-missing-tools link from cyberx86's comment above into this answer as it could be helpful:

Carlos Rendon
- 203
- 2
- 6

Eric Hammond
- 11,163
- 1
- 36
- 56
-
2Note: You'll also need to be able to write to cloudwatch from your instance. You can do this either by creating an IAM role with cloudwatch permissions and attaching it to the instance on launch OR by creating an IAM user for this purpose and saving credentials on each host. The cloudwatch push scripts are then called from cron and they push the desired metrics to cloudwatch regularly. – jorfus Jun 10 '15 at 23:20
-
1The URL has changed to http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/mon-scripts.html – Asfand Qazi Nov 24 '15 at 10:57
3
Amazon doesn't have any visibility into the state of your filesystems.
As such, you'll need to write your own script that pushes disk space metrics into a CW custom metric.

EEAA
- 109,363
- 18
- 175
- 245