Permalink
Browse files

Disk Usage in overview_with_alerts plugin handles terrabytes correctly

  • Loading branch information...
1 parent 0c3b777 commit 30c83853b8e52d888bba58db5d9652f4ffc5dd08 Andre Lewis committed Aug 23, 2011
Showing with 8 additions and 4 deletions.
  1. +8 −4 overview_with_alerts/overview_with_alerts.rb
@@ -254,18 +254,22 @@ def parse_file_systems(io, &line_handler)
end
end
- # Ensures disk space metrics are in GB. Metrics that don't contain 'G,M,or K' are just
+ # Ensures disk space metrics are in GB. Metrics that don't contain 'T,G,M,or K' are just
# turned into integers.
def clean_value(value)
- if value =~ /G/i
+ value = if value =~ /G/i
value.to_f
elsif value =~ /M/i
- (value.to_f/1024.to_f).round
+ (value.to_f/1024.to_f)
elsif value =~ /K/i
- (value.to_f/1024.to_f/1024.to_f).round
+ (value.to_f/1024.to_f/1024.to_f)
+ elsif value =~ /T/i
+ (value.to_f*1024.to_f)
else
value.to_f
end
+
+ ("%.1f" % [value]).to_f
end

0 comments on commit 30c8385

Please sign in to comment.