Sha256: c70393364e528c64f3a2189937e3b9ee2e5eb55ec3638c162c421ed7b9cd0ad5

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 Bytes

Contents

require 'remon/metrics/oom'
defcheck :oom do

  def init(log_file: "/var/log/messages")
    @oom = Metrics::Oom.new(log_file)
  end

  def run
    stats = @oom.stats
    [ oom_event(stats[:today], tag: :today),
      oom_event(stats[:total], tag: :total)]
  end

  private

  def oom_event(count, tag:)
    state = count > 0 ? "warning" : "ok"
    event({
      service: "oom log #{tag}",
      description: "#{count} times oom",
      state: state,
      metric: count
    })
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
remon-0.1.0 lib/remon/checks/oom.rb