Sha256: 025d2236a7a0369f0e2b27986e988d918190a5f08845746809fc831300218e15

Contents?: true

Size: 691 Bytes

Versions: 51

Compression:

Stored size: 691 Bytes

Contents

class Riemann::Babbler::Plugin::StatusFile < Riemann::Babbler::Plugin

  def init
    plugin.set_default(:service, 'check state file')
    plugin.states.set_default(:critical, 1)
    plugin.set_default(:file, '/var/tmp/error.txt')
    plugin.set_default(:interval, 60)
    plugin.set_default(:max_lines, 100)
    plugin.set_default(:report_lines, 5)
  end

  def collect
    return [] unless File.exists? plugin.file
    content = File.read(plugin.file).split("\n").delete_if { |x| x.strip.empty? }
    {
        :service     => plugin.service + " #{plugin.file}",
        :description => content.last(plugin.report_lines).join("\n"),
        :metric      => content.count
    }
  end

end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
riemann-babbler-2.8.5 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.8.4 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.8.3 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.8.2 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.8.1 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.8.0 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.6.0 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.5.9 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.5.8 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.5.7 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.5.6 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.5.5 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.5.4 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.5.3 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.5.2 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.5.1 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.5.0 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.1.5 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.1.4 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-2.1.3.2 lib/riemann/babbler/plugins/status_file.rb