Sha256: 2eb02383e46ffb13e3331f3b1c0ef84114fd4c3c5b9fcd45cbf08a7a81bd9557

Contents?: true

Size: 619 Bytes

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

Version Path
riemann-babbler-1.0.8.5 lib/riemann/babbler/plugins/status_file.rb