Sha256: 524fa0bae2a5329b17a1bbe61f0e8e5631d8dd27ac5207ff2cd267af3c3f65e5

Contents?: true

Size: 665 Bytes

Versions: 33

Compression:

Stored size: 665 Bytes

Contents

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

  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

33 entries across 33 versions & 1 rubygems

Version Path
riemann-babbler-1.2.6 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.2.5 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.2.4 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.2.3 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.2.2 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.2.1 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.2.0 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.1.9 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.1.7 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.1.6 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.0.8.8 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.0.8.7 lib/riemann/babbler/plugins/status_file.rb
riemann-babbler-1.0.8.6 lib/riemann/babbler/plugins/status_file.rb