Sha256: 1a81b7467e9610a3722b516b81008bb1f2e69c1866fcf87d285c4f4fdcfce23a

Contents?: true

Size: 814 Bytes

Versions: 20

Compression:

Stored size: 814 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 -P | grep -i " #{self.mount_point}$" | awk '{print $5}' | sed 's/%//'`
        if usage.to_i > self.above
          self.info = "disk space out of bounds"
          return true
        else
          self.info = "disk space ok"
          return false
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 4 rubygems

Version Path
mojombo-god-0.7.16 lib/god/conditions/disk_usage.rb
mojombo-god-0.7.20 lib/god/conditions/disk_usage.rb
firenxis-god-0.11.0 lib/god/conditions/disk_usage.rb
god-0.11.0 lib/god/conditions/disk_usage.rb
god-0.10.1 lib/god/conditions/disk_usage.rb
god-0.9.0 lib/god/conditions/disk_usage.rb
olgen-god-0.9.2 lib/god/conditions/disk_usage.rb
olgen-god-0.9.1 lib/god/conditions/disk_usage.rb
olgen-god-0.9.0 lib/god/conditions/disk_usage.rb
god-0.8.0 lib/god/conditions/disk_usage.rb
olgen-god-0.8.2 lib/god/conditions/disk_usage.rb
olgen-god-0.8.1 lib/god/conditions/disk_usage.rb
olgen-god-0.8.0 lib/god/conditions/disk_usage.rb
god-0.7.22 lib/god/conditions/disk_usage.rb
god-0.7.21 lib/god/conditions/disk_usage.rb
god-0.7.20 lib/god/conditions/disk_usage.rb
god-0.7.19 lib/god/conditions/disk_usage.rb
god-0.7.18 lib/god/conditions/disk_usage.rb
god-0.7.17 lib/god/conditions/disk_usage.rb
god-0.7.16 lib/god/conditions/disk_usage.rb