Sha256: ea6c907b160714ebbd1a1b4aa8436748a7618c7740407996c1dde3c5441735f4

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

require 'remon/metrics/yum'

defcheck :yum do

  def init
    @yum = Metrics::Yum.new
  end

  def run
    updates_available
  end

  private

  def updates_available
    service = "yum updates"
    count = @yum.updates_available
    state = count > 0 ? "warning" : "ok"
    metric = state == "ok" ? 0 : 1
    event({
      service: service,
      description: "#{count} updates available",
      state: state,
      metric: metric
    })
  rescue => e
    logger.error "#{e.class}: #{e.message}"
    warning_event service
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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