Class: Ropian::Meter::Raritan

Inherits:
Generic
  • Object
show all
Defined in:
lib/ropian/meter/raritan.rb

Constant Summary collapse

UnitCurrent =
SNMP::ObjectId.new("1.3.6.1.4.1.13742.4.1.4.2.1.3.1")
OutletCurrent =
SNMP::ObjectId.new("1.3.6.1.4.1.13742.4.1.2.2.1.4")

Instance Method Summary collapse

Methods inherited from Generic

#initialize, #inspect

Constructor Details

This class inherits a constructor from Ropian::Meter::Generic

Instance Method Details

#collect {|total_amps, results| ... } ⇒ Object

:yields: total_amps, hash_of_outlet_amps

Yields:



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ropian/meter/raritan.rb', line 7

def collect # :yields: total_amps, hash_of_outlet_amps
  results = Hash.new

  @manager.walk(OutletCurrent) do |r|
    r.each do |varbind|
      results[varbind.name.index(OutletCurrent)] = varbind.value.to_f / 1000
    end
  end

  yield total_amps, results
end

#outlet_amps(outlet_index) ⇒ Object

Amps per outlet



23
24
25
# File 'lib/ropian/meter/raritan.rb', line 23

def outlet_amps(outlet_index)
  amps_for_oid(OutletCurrent + outlet_index)
end

#total_ampsObject

Amps in total on whole bar



19
20
21
# File 'lib/ropian/meter/raritan.rb', line 19

def total_amps
  amps_for_oid(UnitCurrent)
end