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