bin/riemann-health in riemann-tools-0.2.7 vs bin/riemann-health in riemann-tools-0.2.8
- old
+ new
@@ -25,23 +25,26 @@
:memory => {:critical => opts[:memory_critical], :warning => opts[:memory_warning]}
}
case (ostype = `uname -s`.chomp.downcase)
when 'darwin'
@cores = `sysctl -n hw.ncpu`.to_i
+ @df = `df -P -t noiso9660`
@cpu = method :darwin_cpu
@disk = method :disk
@load = method :darwin_load
@memory = method :darwin_memory
darwin_top
when 'freebsd'
@cores = `sysctl -n hw.ncpu`.to_i
+ @df = `df -P -t noiso9660`
@cpu = method :freebsd_cpu
@disk = method :disk
@load = method :freebsd_load
@memory = method :freebsd_memory
else
@cores = cores
+ @df = `df -P --exclude-type=iso9660`
puts "WARNING: OS '#{ostype}' not explicitly supported. Falling back to Linux" unless ostype == "linux"
@cpu = method :linux_cpu
@disk = method :disk
@load = method :linux_load
@memory = method :linux_memory
@@ -241,10 +244,10 @@
end
report_pct :memory, @topdata[:memory], "usage\n\n#{`ps -eo pmem,pid,comm | sort -nrb -k1 | head -10`.chomp}"
end
def disk
- `df -P`.split(/\n/).each do |r|
+ @df.split(/\n/).each do |r|
f = r.split(/\s+/)
next if f[0] == 'Filesystem'
next unless f[0] =~ /\// # Needs at least one slash in the mount path
# Calculate capacity