Class: ForemanMaintain::Utils::Disk::IODevice
- Inherits:
-
Object
- Object
- ForemanMaintain::Utils::Disk::IODevice
- Includes:
- Concerns::SystemHelpers
- Defined in:
- lib/foreman_maintain/utils/disk/io_device.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
Instance Method Summary collapse
- #available_space ⇒ Object
-
#initialize(dir) ⇒ IODevice
constructor
A new instance of IODevice.
- #read_speed ⇒ Object
- #space_used_in_percent ⇒ Object
- #unit ⇒ Object
Methods included from Concerns::SystemHelpers
#check_max_version, #check_min_version, #command_present?, #create_lv_snapshot, #directory_empty?, #execute, #execute!, #execute?, #execute_runner, #execute_with_status, #file_exists?, #file_nonzero?, #find_dir_containing_file, #find_package, #find_symlinks, #format_shell_args, #get_lv_info, #get_lv_path, #hostname, included, #package_manager, #package_version, #packages_action, #parse_csv, #parse_json, #rpm_version, #server?, #shellescape, #systemd_installed?, #version
Methods included from Concerns::Finders
#check, #detector, #feature, #find_all_scenarios, #find_checks, #find_procedures, #find_scenarios, #procedure
Methods included from Concerns::Logger
Constructor Details
#initialize(dir) ⇒ IODevice
Returns a new instance of IODevice.
9 10 11 |
# File 'lib/foreman_maintain/utils/disk/io_device.rb', line 9 def initialize(dir) @dir = dir end |
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
7 8 9 |
# File 'lib/foreman_maintain/utils/disk/io_device.rb', line 7 def dir @dir end |
Instance Method Details
#available_space ⇒ Object
21 22 23 |
# File 'lib/foreman_maintain/utils/disk/io_device.rb', line 21 def available_space convert_kb_to_mb(execute!("df #{dir}|awk {'print $4'}|tail -1").to_i) end |
#read_speed ⇒ Object
13 14 15 |
# File 'lib/foreman_maintain/utils/disk/io_device.rb', line 13 def read_speed @read_speed ||= convert_kb_to_mb(fio) end |
#space_used_in_percent ⇒ Object
25 26 27 |
# File 'lib/foreman_maintain/utils/disk/io_device.rb', line 25 def space_used_in_percent execute!("df #{dir}|awk {'print $5'}|tail -1").to_i end |
#unit ⇒ Object
17 18 19 |
# File 'lib/foreman_maintain/utils/disk/io_device.rb', line 17 def unit @unit ||= 'MB/sec' end |