# File lib/foreman_maintain/utils/disk/device.rb, line 17 def initialize(dir) @dir = dir @name = find_device @io_device = init_io_device end
# File lib/foreman_maintain/utils/disk/device.rb, line 29 def performance "#{read_speed} #{unit}" end
# File lib/foreman_maintain/utils/disk/device.rb, line 23 def slow_disk_error_msg "Slow disk detected #{dir} mounted on #{name}. Actual disk speed: #{read_speed} #{default_unit} Expected disk speed: #{expected_io} #{default_unit}." end
# File lib/foreman_maintain/utils/disk/device.rb, line 52 def default_unit Checks::Disk::Performance::DEFAULT_UNIT end
# File lib/foreman_maintain/utils/disk/device.rb, line 56 def expected_io Checks::Disk::Performance::EXPECTED_IO end
# File lib/foreman_maintain/utils/disk/device.rb, line 43 def externally_mounted? device_type = execute("stat -f -c %T #{dir}") EXTERNAL_MOUNT_TYPE.include?(device_type) end
# File lib/foreman_maintain/utils/disk/device.rb, line 48 def find_device execute("df -h #{dir} | sed -n '2p' | awk '{print $1}'") end
# File lib/foreman_maintain/utils/disk/device.rb, line 35 def init_io_device if externally_mounted? IO::FileSystem else IO::BlockDevice end.new(dir, name) end