Sha256: ad1648e09f0119fa2e59d221e6faf87bd7cb706eb6390f53a34f135d73f3ca1a

Contents?: true

Size: 406 Bytes

Versions: 3

Compression:

Stored size: 406 Bytes

Contents

module Perus::Pinger
    class HD < Command
        description 'Measures the percentage of disk space currently used on
                     the specified drive.'
        option :drive
        metric!
        
        def run
            regex = "/^#{options.drive.gsub("/", "\\/")}/"
            percent = `df -h / | awk '#{regex} {print $5}'`
            {hd_used: percent.to_i}
        end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
perus-0.1.2 lib/perus/pinger/metrics/hd.rb
perus-0.1.1 lib/perus/pinger/metrics/hd.rb
perus-0.1.0 lib/perus/pinger/metrics/hd.rb