lib/arborist/monitor/snmp/ups/battery.rb
changeset 22 d36032444b99
parent 20 00a38d493f2c
child 23 a363d4d5a895
--- a/lib/arborist/monitor/snmp/ups/battery.rb	Thu Apr 18 11:59:38 2019 -0700
+++ b/lib/arborist/monitor/snmp/ups/battery.rb	Thu Apr 18 12:11:01 2019 -0700
@@ -86,11 +86,11 @@
 
 		# don't report voltage if the UPS doesn't
 		voltage = snmp.get( oid: OIDS[:battery_voltage] ) rescue nil
-		info[ :voltage ] = voltage / 10 unless voltage.nil?
+		info[ :voltage ] = voltage / 10 if voltage
 
 		# don't report current if the UPS doesn't
 		current = snmp.get( oid: OIDS[:battery_current] ) rescue nil
-		info[ :current ] = current/10 unless current.nil?
+		info[ :current ] = current/10 if current
 
 		# see if we are on battery
 		info[ :seconds_on_battery ] = snmp.get( oid: OIDS[:seconds_on_battery] ) rescue 0