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

Version Path
kurchatov-0.4.7 examples/find_files.rb
kurchatov-0.4.6 examples/find_files.rb
kurchatov-0.4.5 examples/find_files.rb
kurchatov-0.4.4 examples/find_files.rb
kurchatov-0.4.3 examples/find_files.rb
kurchatov-0.4.2 examples/find_files.rb
kurchatov-0.4.1 examples/find_files.rb
kurchatov-0.3.8 examples/find_files.rb
kurchatov-0.3.7 examples/find_files.rb
kurchatov-0.3.6 examples/find_files.rb
kurchatov-0.3.5 examples/find_files.rb
kurchatov-0.3.4 examples/find_files.rb
kurchatov-0.3.3 examples/find_files.rb
kurchatov-0.3.2 examples/find_files.rb
kurchatov-0.3.1 examples/find_files.rb
kurchatov-0.3.0 examples/find_files.rb
kurchatov-0.2.9 examples/find_files.rb
kurchatov-0.2.8 examples/find_files.rb
kurchatov-0.2.7 examples/find_files.rb
kurchatov-0.2.6 examples/find_files.rb