Sha256: 81843238280a0e0f52547b03e9fb79799f994ad0c598c01313204d9915e12a42

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

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

  opts ({
    warning: 85,
    critical: 95
  })

  def init
    @disk = Metrics::Disk.new
  end

  def run
    disk
  end

  private

  def disk
    disks = @disk.disks_usage
    max = disks.max_by { |d| d[:percent] }
    metric = max[:percent]
    s = service_state(metric * 100)
    event({
      service: "disk",
      description: description(disks),
      state: s,
      metric: metric
    })
  end

  def description(disks)
    disks.map { |i| "#{i[:mount]} - #{(i[:percent]*100).round 2}% #{i[:size]}"}.join("\n")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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