Class: Diskmon::HardDisk
- Inherits:
-
Object
- Object
- Diskmon::HardDisk
- Defined in:
- lib/diskmon/client/harddisk.rb,
lib/diskmon/server/harddisk.rb
Instance Attribute Summary collapse
-
#age_hours ⇒ Object
Returns the value of attribute age_hours.
-
#checksum_errors ⇒ Object
Returns the value of attribute checksum_errors.
-
#ctl_id ⇒ Object
Returns the value of attribute ctl_id.
-
#dri ⇒ Object
TODO: convert to bytes def size(size) @size = end.
-
#error_events ⇒ Object
Returns the value of attribute error_events.
-
#member_of_zpool ⇒ Object
Returns the value of attribute member_of_zpool.
-
#port ⇒ Object
Returns the value of attribute port.
-
#read_errors ⇒ Object
Returns the value of attribute read_errors.
-
#reallocs ⇒ Object
Returns the value of attribute reallocs.
-
#serial ⇒ Object
Returns the value of attribute serial.
-
#short_device ⇒ Object
Returns the value of attribute short_device.
-
#size ⇒ Object
Returns the value of attribute size.
-
#smart_status ⇒ Object
Returns the value of attribute smart_status.
-
#smart_status_raw ⇒ Object
array of hex numbers.
-
#spindle_speed ⇒ Object
rpms.
-
#status ⇒ Object
Returns the value of attribute status.
-
#system_device ⇒ Object
Returns the value of attribute system_device.
-
#temperature ⇒ Object
Returns the value of attribute temperature.
-
#type ⇒ Object
sata or sas.
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#vendor_model ⇒ Object
Returns the value of attribute vendor_model.
-
#write_errors ⇒ Object
Returns the value of attribute write_errors.
-
#zpool_free_space ⇒ Object
Returns the value of attribute zpool_free_space.
-
#zpool_health ⇒ Object
Returns the value of attribute zpool_health.
-
#zpool_last_command ⇒ Object
Returns the value of attribute zpool_last_command.
-
#zpool_total_space ⇒ Object
Returns the value of attribute zpool_total_space.
Instance Method Summary collapse
Instance Attribute Details
#age_hours ⇒ Object
Returns the value of attribute age_hours.
22 23 24 |
# File 'lib/diskmon/client/harddisk.rb', line 22 def age_hours @age_hours end |
#checksum_errors ⇒ Object
Returns the value of attribute checksum_errors.
32 33 34 |
# File 'lib/diskmon/client/harddisk.rb', line 32 def checksum_errors @checksum_errors end |
#ctl_id ⇒ Object
Returns the value of attribute ctl_id.
11 12 13 |
# File 'lib/diskmon/client/harddisk.rb', line 11 def ctl_id @ctl_id end |
#dri ⇒ Object
TODO: convert to bytes def size(size)
@size =
end
10 11 12 |
# File 'lib/diskmon/client/harddisk.rb', line 10 def dri @dri end |
#error_events ⇒ Object
Returns the value of attribute error_events.
27 28 29 |
# File 'lib/diskmon/client/harddisk.rb', line 27 def error_events @error_events end |
#member_of_zpool ⇒ Object
Returns the value of attribute member_of_zpool.
29 30 31 |
# File 'lib/diskmon/client/harddisk.rb', line 29 def member_of_zpool @member_of_zpool end |
#port ⇒ Object
Returns the value of attribute port.
12 13 14 |
# File 'lib/diskmon/client/harddisk.rb', line 12 def port @port end |
#read_errors ⇒ Object
Returns the value of attribute read_errors.
30 31 32 |
# File 'lib/diskmon/client/harddisk.rb', line 30 def read_errors @read_errors end |
#reallocs ⇒ Object
Returns the value of attribute reallocs.
21 22 23 |
# File 'lib/diskmon/client/harddisk.rb', line 21 def reallocs @reallocs end |
#serial ⇒ Object
Returns the value of attribute serial.
24 25 26 |
# File 'lib/diskmon/client/harddisk.rb', line 24 def serial @serial end |
#short_device ⇒ Object
Returns the value of attribute short_device.
40 41 42 |
# File 'lib/diskmon/client/harddisk.rb', line 40 def short_device @short_device end |
#size ⇒ Object
Returns the value of attribute size.
19 20 21 |
# File 'lib/diskmon/client/harddisk.rb', line 19 def size @size end |
#smart_status ⇒ Object
Returns the value of attribute smart_status.
18 19 20 |
# File 'lib/diskmon/client/harddisk.rb', line 18 def smart_status @smart_status end |
#smart_status_raw ⇒ Object
array of hex numbers
17 18 19 |
# File 'lib/diskmon/client/harddisk.rb', line 17 def smart_status_raw @smart_status_raw end |
#spindle_speed ⇒ Object
rpms
25 26 27 |
# File 'lib/diskmon/client/harddisk.rb', line 25 def spindle_speed @spindle_speed end |
#status ⇒ Object
Returns the value of attribute status.
13 14 15 |
# File 'lib/diskmon/client/harddisk.rb', line 13 def status @status end |
#system_device ⇒ Object
Returns the value of attribute system_device.
39 40 41 |
# File 'lib/diskmon/client/harddisk.rb', line 39 def system_device @system_device end |
#temperature ⇒ Object
Returns the value of attribute temperature.
23 24 25 |
# File 'lib/diskmon/client/harddisk.rb', line 23 def temperature @temperature end |
#type ⇒ Object
sata or sas
15 16 17 |
# File 'lib/diskmon/client/harddisk.rb', line 15 def type @type end |
#unit ⇒ Object
Returns the value of attribute unit.
14 15 16 |
# File 'lib/diskmon/client/harddisk.rb', line 14 def unit @unit end |
#vendor_model ⇒ Object
Returns the value of attribute vendor_model.
16 17 18 |
# File 'lib/diskmon/client/harddisk.rb', line 16 def vendor_model @vendor_model end |
#write_errors ⇒ Object
Returns the value of attribute write_errors.
31 32 33 |
# File 'lib/diskmon/client/harddisk.rb', line 31 def write_errors @write_errors end |
#zpool_free_space ⇒ Object
Returns the value of attribute zpool_free_space.
37 38 39 |
# File 'lib/diskmon/client/harddisk.rb', line 37 def zpool_free_space @zpool_free_space end |
#zpool_health ⇒ Object
Returns the value of attribute zpool_health.
34 35 36 |
# File 'lib/diskmon/client/harddisk.rb', line 34 def zpool_health @zpool_health end |
#zpool_last_command ⇒ Object
Returns the value of attribute zpool_last_command.
35 36 37 |
# File 'lib/diskmon/client/harddisk.rb', line 35 def zpool_last_command @zpool_last_command end |
#zpool_total_space ⇒ Object
Returns the value of attribute zpool_total_space.
36 37 38 |
# File 'lib/diskmon/client/harddisk.rb', line 36 def zpool_total_space @zpool_total_space end |
Instance Method Details
#checksum ⇒ Object
12 13 14 15 16 17 |
# File 'lib/diskmon/server/harddisk.rb', line 12 def checksum as_str = '' instance_variables.sort.map { |k| as_str << "#{k}=#{instance_variable_get(k)};" } p as_str if $DEBUG Digest::MD5.hexdigest(as_str) end |
#to_hash ⇒ Object
credit: stackoverflow.com/a/5031637
8 9 10 |
# File 'lib/diskmon/server/harddisk.rb', line 8 def to_hash Hash[instance_variables.map { |var| [var[1..-1].to_sym, instance_variable_get(var)] }] end |