Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add FreeDiskSpace metric

  • Loading branch information...
commit 2e70d9bc8b80a991a4a3a4ab0ef0794dcbf3ee7e 1 parent 42fcb5e
Lewis Marshall authored October 19, 2011

Showing 1 changed file with 8 additions and 0 deletions. Show diff stats Hide diff stats

  1. 8  send_data.rb
8  send_data.rb
@@ -7,6 +7,7 @@
7 7
 inactive_mem  = `vmstat -s -S M | grep 'inactive mem' | awk '{print $1}'`.to_i
8 8
 free_mem      = `vmstat -s -S M | grep 'free mem' | awk '{print $1}'`.to_i
9 9
 swap_used     = `vmstat -s -S M | grep 'used swap' | awk '{print $1}'`.to_i
  10
+disk_avail    = `df | grep '\/$' | awk '{print $4}'`.to_i
10 11
 
11 12
 metric_data = []
12 13
 
@@ -24,6 +25,13 @@
24 25
   'Dimensions'  => [{'Name' => 'InstanceId', 'Value' => instance_id}]
25 26
 })
26 27
 
  28
+metric_data.push({
  29
+  'MetricName'  => 'FreeDiskSpace',
  30
+  'Unit'        => 'Gigabytes',
  31
+  'Value'       => disk_avail / 1048576,
  32
+  'Dimensions'  => [{'Name' => 'InstanceId', 'Value' => instance_id}]
  33
+})
  34
+
27 35
 Fog::AWS::CloudWatch.new(
28 36
   :aws_secret_access_key  => secret_key,
29 37
   :aws_access_key_id      => access_key

0 notes on commit 2e70d9b

Please sign in to comment.
Something went wrong with that request. Please try again.