bin/metrics-disk-usage.rb in sensu-plugins-disk-checks-3.0.1 vs bin/metrics-disk-usage.rb in sensu-plugins-disk-checks-3.1.0

- old
+ new

@@ -93,10 +93,16 @@ # def run delim = config[:flatten] == true ? '_' : '.' # Get disk usage from df with used and avail in megabytes # #YELLOW - `df -PB#{config[:block_size]} #{config[:local] ? '-l' : ''}`.split("\n").drop(1).each do |line| + command = if Gem::Platform.local.os == 'solaris' + "df -k #{config[:local] ? '-l' : ''}" + else + "df -PB#{config[:block_size]} #{config[:local] ? '-l' : ''}" + end + + `#{command}`.split("\n").drop(1).each do |line| _, _, used, avail, used_p, mnt = line.split unless %r{/sys[/|$]|/dev[/|$]|/run[/|$]} =~ mnt next if config[:ignore_mnt] && config[:ignore_mnt].find { |x| mnt.match(x) } next if config[:include_mnt] && !config[:include_mnt].find { |x| mnt.match(x) }