Class: Diskmon::HardDisk

Inherits:
Object
  • Object
show all
Defined in:
lib/diskmon/client/harddisk.rb,
lib/diskmon/server/harddisk.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#age_hoursObject

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_errorsObject

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_idObject

Returns the value of attribute ctl_id.



11
12
13
# File 'lib/diskmon/client/harddisk.rb', line 11

def ctl_id
  @ctl_id
end

#driObject

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_eventsObject

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_zpoolObject

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

#portObject

Returns the value of attribute port.



12
13
14
# File 'lib/diskmon/client/harddisk.rb', line 12

def port
  @port
end

#read_errorsObject

Returns the value of attribute read_errors.



30
31
32
# File 'lib/diskmon/client/harddisk.rb', line 30

def read_errors
  @read_errors
end

#reallocsObject

Returns the value of attribute reallocs.



21
22
23
# File 'lib/diskmon/client/harddisk.rb', line 21

def reallocs
  @reallocs
end

#serialObject

Returns the value of attribute serial.



24
25
26
# File 'lib/diskmon/client/harddisk.rb', line 24

def serial
  @serial
end

#short_deviceObject

Returns the value of attribute short_device.



40
41
42
# File 'lib/diskmon/client/harddisk.rb', line 40

def short_device
  @short_device
end

#sizeObject

Returns the value of attribute size.



19
20
21
# File 'lib/diskmon/client/harddisk.rb', line 19

def size
  @size
end

#smart_statusObject

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_rawObject

array of hex numbers



17
18
19
# File 'lib/diskmon/client/harddisk.rb', line 17

def smart_status_raw
  @smart_status_raw
end

#spindle_speedObject

rpms



25
26
27
# File 'lib/diskmon/client/harddisk.rb', line 25

def spindle_speed
  @spindle_speed
end

#statusObject

Returns the value of attribute status.



13
14
15
# File 'lib/diskmon/client/harddisk.rb', line 13

def status
  @status
end

#system_deviceObject

Returns the value of attribute system_device.



39
40
41
# File 'lib/diskmon/client/harddisk.rb', line 39

def system_device
  @system_device
end

#temperatureObject

Returns the value of attribute temperature.



23
24
25
# File 'lib/diskmon/client/harddisk.rb', line 23

def temperature
  @temperature
end

#typeObject

sata or sas



15
16
17
# File 'lib/diskmon/client/harddisk.rb', line 15

def type
  @type
end

#unitObject

Returns the value of attribute unit.



14
15
16
# File 'lib/diskmon/client/harddisk.rb', line 14

def unit
  @unit
end

#vendor_modelObject

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_errorsObject

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_spaceObject

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_healthObject

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_commandObject

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_spaceObject

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

#checksumObject



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_hashObject



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