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