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-1.0.7 lib/perus/pinger/metrics/hd.rb
perus-1.0.6 lib/perus/pinger/metrics/hd.rb
perus-1.0.5 lib/perus/pinger/metrics/hd.rb
perus-1.0.4 lib/perus/pinger/metrics/hd.rb
perus-1.0.3 lib/perus/pinger/metrics/hd.rb
perus-1.0.2 lib/perus/pinger/metrics/hd.rb
perus-1.0.1 lib/perus/pinger/metrics/hd.rb
perus-1.0.0 lib/perus/pinger/metrics/hd.rb
perus-0.1.35 lib/perus/pinger/metrics/hd.rb
perus-0.1.34 lib/perus/pinger/metrics/hd.rb
perus-0.1.33 lib/perus/pinger/metrics/hd.rb
perus-0.1.32 lib/perus/pinger/metrics/hd.rb
perus-0.1.31 lib/perus/pinger/metrics/hd.rb
perus-0.1.30 lib/perus/pinger/metrics/hd.rb
perus-0.1.29 lib/perus/pinger/metrics/hd.rb
perus-0.1.28 lib/perus/pinger/metrics/hd.rb
perus-0.1.27 lib/perus/pinger/metrics/hd.rb
perus-0.1.26 lib/perus/pinger/metrics/hd.rb
perus-0.1.25 lib/perus/pinger/metrics/hd.rb
perus-0.1.24 lib/perus/pinger/metrics/hd.rb