Sha256: 7abae385e8ff8be75ef40a828c78c8b01ddb4ae5f97f9fa85edee9211deb2cb3
Contents?: true
Size: 567 Bytes
Versions: 51
Compression:
Stored size: 567 Bytes
Contents
interval 60 warning 5 default[:file_mask] = '.*' default[:dir] = '/tmp/dir' default[:age] = 24 * 60 * 60 collect do if File.directory?(plugin.dir) count_files = 0 file_mask = Regexp.new(plugin.file_mask) Find.find(plugin.dir).each do |file| next unless File.file? file next unless file_mask.match file next unless Time.now.to_i - plugin.age > File.new(file).mtime.to_i count_files += 1 end event(:service => "find files #{plugin.dir}", :metric => count_files, :description => "Count files in #{plugin.dir}") end end
Version data entries
51 entries across 51 versions & 1 rubygems