Sha256: 6e68ddc25c1adaf6aa015631dbb03a3f3aa069c068ca1b51afa714803c79fdbc
Contents?: true
Size: 688 Bytes
Versions: 4
Compression:
Stored size: 688 Bytes
Contents
require 'sys/filesystem' collect do Sys::Filesystem.mounts do |mount| st = Sys::Filesystem.stat(mount.mount_point) rescue next next if st.blocks == 0 or st.files == 0 case mp = mount.mount_point when '/' 'rootfs' when /^\/.+$/ mp[1..-1].tr('^[a-z][0-9]', '-') else 'unknown' end.tap do |name| next if config.exclude.map {|e| Regexp.new(e).match(name)}.any? block_pc = 1.0 - (st.blocks_free.to_f / st.blocks.to_f) Metriks.histogram("os.disk:#{name}.blocks").update(block_pc) files_pc = 1.0 - (st.files_free.to_f / st.files.to_f) Metriks.histogram("os.disk:#{name}.files").update(files_pc) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ganymed-0.5.2 | lib/ganymed/collectors/disk.rb |
ganymed-0.5.1 | lib/ganymed/collectors/disk.rb |
ganymed-0.5.0 | lib/ganymed/collectors/disk.rb |
ganymed-0.4.4 | lib/ganymed/collectors/disk.rb |