lib/arborist/monitor/snmp/ups/battery.rb
changeset 22 d36032444b99
parent 20 00a38d493f2c
child 23 a363d4d5a895
equal deleted inserted replaced
21:58e70e52f817 22:d36032444b99
    84 		info[ :temperature ] = snmp.get( oid: OIDS[:battery_temperature] )
    84 		info[ :temperature ] = snmp.get( oid: OIDS[:battery_temperature] )
    85 		info[ :minutes_remaining ]  = snmp.get( oid: OIDS[:est_minutes_remaining] )
    85 		info[ :minutes_remaining ]  = snmp.get( oid: OIDS[:est_minutes_remaining] )
    86 
    86 
    87 		# don't report voltage if the UPS doesn't
    87 		# don't report voltage if the UPS doesn't
    88 		voltage = snmp.get( oid: OIDS[:battery_voltage] ) rescue nil
    88 		voltage = snmp.get( oid: OIDS[:battery_voltage] ) rescue nil
    89 		info[ :voltage ] = voltage / 10 unless voltage.nil?
    89 		info[ :voltage ] = voltage / 10 if voltage
    90 
    90 
    91 		# don't report current if the UPS doesn't
    91 		# don't report current if the UPS doesn't
    92 		current = snmp.get( oid: OIDS[:battery_current] ) rescue nil
    92 		current = snmp.get( oid: OIDS[:battery_current] ) rescue nil
    93 		info[ :current ] = current/10 unless current.nil?
    93 		info[ :current ] = current/10 if current
    94 
    94 
    95 		# see if we are on battery
    95 		# see if we are on battery
    96 		info[ :seconds_on_battery ] = snmp.get( oid: OIDS[:seconds_on_battery] ) rescue 0
    96 		info[ :seconds_on_battery ] = snmp.get( oid: OIDS[:seconds_on_battery] ) rescue 0
    97 		info[ :in_use ] = ( info[ :seconds_on_battery ] != 0 )
    97 		info[ :in_use ] = ( info[ :seconds_on_battery ] != 0 )
    98 
    98