Class: Perus::Pinger::HD

Inherits:
Command show all
Defined in:
lib/perus/pinger/metrics/hd.rb

Instance Attribute Summary

Attributes inherited from Command

#id, #options

Instance Method Summary collapse

Methods inherited from Command

abstract!, abstract?, #cleanup, #darwin?, description, human_name, inherited, #initialize, metric!, metric?, option, options, #shell, subclasses

Constructor Details

This class inherits a constructor from Perus::Pinger::Command

Instance Method Details

#runObject



8
9
10
11
12
# File 'lib/perus/pinger/metrics/hd.rb', line 8

def run
    regex = "/^#{options.drive.gsub("/", "\\/")}/"
    percent = shell("df -h / | awk '#{regex} {print $5}'")
    {hd_used: percent.to_i}
end