Sha256: c95b48c35f62f041b811af42a694d879f111aa208245a90845baf2cab04f4bd7

Contents?: true

Size: 657 Bytes

Versions: 47

Compression:

Stored size: 657 Bytes

Contents

module God
  module Conditions
    
    class DiskUsage < PollCondition
      attr_accessor :above, :mount_point
      
      def initialize
        super
        self.above = nil
        self.mount_point = nil
      end
      
      def valid?
        valid = true
        valid &= complain("Attribute 'mount_point' must be specified", self) if self.mount_point.nil?
        valid &= complain("Attribute 'above' must be specified", self) if self.above.nil?
        valid
      end
      
      def test
        usage = `df | grep -i " #{self.mount_point}$" | awk '{print $5}' | sed 's/%//'`
        usage.to_i > self.above
      end
    end
    
  end
end

Version data entries

47 entries across 47 versions & 18 rubygems

Version Path
dguettler-god-0.7.13.2 lib/god/conditions/disk_usage.rb
dguettler-god-0.7.13.3 lib/god/conditions/disk_usage.rb
dosire-god-0.7.10 lib/god/conditions/disk_usage.rb
dosire-god-0.7.12 lib/god/conditions/disk_usage.rb
dosire-god-0.7.9 lib/god/conditions/disk_usage.rb
dunedain289-god-0.7.12.1 lib/god/conditions/disk_usage.rb
dustin-god-0.7.7.1 lib/god/conditions/disk_usage.rb
eric-god-0.7.10 lib/god/conditions/disk_usage.rb
eric-god-0.7.11 lib/god/conditions/disk_usage.rb
eric-god-0.7.12 lib/god/conditions/disk_usage.rb
eric-god-0.7.14 lib/god/conditions/disk_usage.rb
eric-god-0.7.7 lib/god/conditions/disk_usage.rb
fotonauts-god-0.7.10 lib/god/conditions/disk_usage.rb
fotonauts-god-0.7.12 lib/god/conditions/disk_usage.rb
gohanlonllc-god-0.7.9 lib/god/conditions/disk_usage.rb
gordoncww-god-0.7.11.1 lib/god/conditions/disk_usage.rb
jwilkins-god-0.7.9 lib/god/conditions/disk_usage.rb
mathieuravaux-god-0.7.11 lib/god/conditions/disk_usage.rb
mojombo-god-0.7.10 lib/god/conditions/disk_usage.rb
mojombo-god-0.7.11 lib/god/conditions/disk_usage.rb