# 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 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 48 def default_unit Checks::DiskSpeedMinimal::DEFAULT_UNIT end
# File lib/foreman_maintain/utils/disk/device.rb, line 52 def expected_io Checks::DiskSpeedMinimal::EXPECTED_IO end
# File lib/foreman_maintain/utils/disk/device.rb, line 39 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 44 def find_device execute("df -h #{dir} | sed -n '2p' | awk '{print $1}'") end
# File lib/foreman_maintain/utils/disk/device.rb, line 31 def init_io_device if externally_mounted? IO::FileSystem else IO::BlockDevice end.new(dir, name) end