Sha256: ec5eaf9aa1fccc71c5a1736f3bd9a9ff702e6fbe6c77304528bde71e39edde91

Contents?: true

Size: 569 Bytes

Versions: 14

Compression:

Stored size: 569 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

14 entries across 14 versions & 1 rubygems

Version Path
kurchatov-0.0.5.pre5 examples/find_files.rb
kurchatov-0.0.5.pre4 examples/find_files.rb
kurchatov-0.0.5.pre2 examples/find_files.rb
kurchatov-0.0.5.pre1 examples/find_files.rb
kurchatov-0.0.4 examples/find_files.rb
kurchatov-0.0.4d examples/find_files.rb
kurchatov-0.0.4c examples/find_files.rb
kurchatov-0.0.4b examples/find_files.rb
kurchatov-0.0.3 examples/find_files.rb
kurchatov-0.0.3b examples/find_files.rb
kurchatov-0.0.3a examples/find_files.rb
kurchatov-0.0.2 examples/find_files.rb
kurchatov-0.0.2b examples/find_files.rb
kurchatov-0.0.1 examples/find_files.rb