Permalink
Browse files

Add FreeDiskSpace metric

  • Loading branch information...
1 parent 42fcb5e commit 2e70d9bc8b80a991a4a3a4ab0ef0794dcbf3ee7e Lewis Marshall committed Oct 19, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 send_data.rb
View
@@ -7,6 +7,7 @@
inactive_mem = `vmstat -s -S M | grep 'inactive mem' | awk '{print $1}'`.to_i
free_mem = `vmstat -s -S M | grep 'free mem' | awk '{print $1}'`.to_i
swap_used = `vmstat -s -S M | grep 'used swap' | awk '{print $1}'`.to_i
+disk_avail = `df | grep '\/$' | awk '{print $4}'`.to_i
metric_data = []
@@ -24,6 +25,13 @@
'Dimensions' => [{'Name' => 'InstanceId', 'Value' => instance_id}]
})
+metric_data.push({
+ 'MetricName' => 'FreeDiskSpace',
+ 'Unit' => 'Gigabytes',
+ 'Value' => disk_avail / 1048576,
+ 'Dimensions' => [{'Name' => 'InstanceId', 'Value' => instance_id}]
+})
+
Fog::AWS::CloudWatch.new(
:aws_secret_access_key => secret_key,
:aws_access_key_id => access_key

0 comments on commit 2e70d9b

Please sign in to comment.