# File lib/rubyipmi/freeipmi/commands/sensors.rb, line 5 def initialize(opts = ObservableHash.new) super("ipmi-sensors", opts) end
# File lib/rubyipmi/freeipmi/commands/sensors.rb, line 18 def count list.count end
returns a hash of fan sensors where the key is fan name and value is the sensor
# File lib/rubyipmi/freeipmi/commands/sensors.rb, line 27 def fanlist(refreshdata=false) refresh if refreshdata flist = {} list.each do | name,sensor | if name =~ /.*fan.*/ flist[name] = sensor end end return flist end
# File lib/rubyipmi/freeipmi/commands/sensors.rb, line 50 def getsensors @options["no-header-output"] = false @options["output-sensor-state"] = false @options["entity-sensor-names"] = false value = runcmd @options.delete_notify('no-header-output') @options.delete_notify('output-sensor-state') @options.delete_notify('entity-sensor-names') @result end
# File lib/rubyipmi/freeipmi/commands/sensors.rb, line 14 def list @sensors ||= parse(getsensors) end
# File lib/rubyipmi/freeipmi/commands/sensors.rb, line 22 def names list.keys end
# File lib/rubyipmi/freeipmi/commands/sensors.rb, line 9 def refresh @sensors = nil list end
returns a hash of sensors where each key is the name of the sensor and the value is the sensor
# File lib/rubyipmi/freeipmi/commands/sensors.rb, line 39 def templist(refreshdata=false) refresh if refreshdata tlist = {} list.each do | name , sensor | if sensor[:unit] =~ /.*degree.*/ || name =~ /.*temp.*/ tlist[name] = sensor end end return tlist end
# File lib/rubyipmi/freeipmi/commands/sensors.rb, line 63 def method_missing(method, *args, &block) if not list.has_key?(method.to_s) raise NoMethodError else list[method.to_s] end end
# File lib/rubyipmi/freeipmi/commands/sensors.rb, line 71 def parse(data) sensorlist = {} if ! data.nil? data.lines.each do | line| # skip the header sensor = Sensor.new(line) sensorlist[sensor[:name]] = sensor end end return sensorlist end