Sha256: e912c19addb2f537002b945ffb7763c98d441f997e59d8c609c036354ca18eed

Contents?: true

Size: 577 Bytes

Versions: 3

Compression:

Stored size: 577 Bytes

Contents

class DiskUsage
	
	include Watchman
	
	set_default :usage_threshold, 75
	
	def self.data
		dat = DF.data
		sum = dat.select {|d| d[:mounted]=="/"}.first
		{:partitions => dat, :summary => sum[:capacity] || sum["use%".to_sym]}
	end
	
	add_rule(:root_usage_high) do |data|
		
		if (usage = data[:summary].to_i) && usage > option(:usage_threshold)
			send_alert "Root disk usage is over #{option(:usage_threshold)}% (#{usage}%)", data[:partitions].select {|d| d[:mounted]=="/"}.first
			set_flag :root_disk_over_quota
		else
			clear_flag :root_disk_over_quota
		end
		
	end
	
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
city-watch-0.5.6 lib/city_watch/watchmen/disk_usage.rb
city-watch-0.5.5 lib/city_watch/watchmen/disk_usage.rb
city-watch-0.5.4 lib/city_watch/watchmen/disk_usage.rb