Sha256: bc7120978b9adbbd7a761de806843c7988b004f8d07b5364f56cea157132acd8

Contents?: true

Size: 413 Bytes

Versions: 41

Compression:

Stored size: 413 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 = shell("df -h / | awk '#{regex} {print $5}'")
            {hd_used: percent.to_i}
        end
    end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
perus-0.1.23 lib/perus/pinger/metrics/hd.rb
perus-0.1.22 lib/perus/pinger/metrics/hd.rb
perus-0.1.21 lib/perus/pinger/metrics/hd.rb
perus-0.1.20 lib/perus/pinger/metrics/hd.rb
perus-0.1.19 lib/perus/pinger/metrics/hd.rb
perus-0.1.18 lib/perus/pinger/metrics/hd.rb
perus-0.1.17 lib/perus/pinger/metrics/hd.rb
perus-0.1.16 lib/perus/pinger/metrics/hd.rb
perus-0.1.15 lib/perus/pinger/metrics/hd.rb
perus-0.1.14 lib/perus/pinger/metrics/hd.rb
perus-0.1.13 lib/perus/pinger/metrics/hd.rb
perus-0.1.12 lib/perus/pinger/metrics/hd.rb
perus-0.1.11 lib/perus/pinger/metrics/hd.rb
perus-0.1.10 lib/perus/pinger/metrics/hd.rb
perus-0.1.9 lib/perus/pinger/metrics/hd.rb
perus-0.1.8 lib/perus/pinger/metrics/hd.rb
perus-0.1.7 lib/perus/pinger/metrics/hd.rb
perus-0.1.6 lib/perus/pinger/metrics/hd.rb
perus-0.1.5 lib/perus/pinger/metrics/hd.rb
perus-0.1.4 lib/perus/pinger/metrics/hd.rb