Added UPS SNMP values

This commit is contained in:
Veros Kaplan 2014-03-03 17:53:22 +01:00
parent e911bd33ba
commit 18f68d4e36
4 changed files with 66 additions and 3 deletions

23
ini/ups-battery.ini Normal file
View File

@ -0,0 +1,23 @@
# UPS with SNMP - tested on Riello
#
# battery status and ups load
#
[value:minutes_remaining]
oid = .1.3.6.1.2.1.33.1.2.3.0
warning = minutes_remaining < 7
critical = minutes_remaining < 5
name = Minutes remaining
units = min
[value:battery_status]
oid = .1.3.6.1.2.1.33.1.2.1.0
warning = battery_status != 2
name = Battery status
[value:load]
oid = .1.3.6.1.2.1.33.1.4.4.1.5.1
units = %
warning = (load > 85)
critical = (load > 90)
name = Output load

20
ini/ups-input.ini Normal file
View File

@ -0,0 +1,20 @@
# UPS with SNMP - tested on Riello
#
# input sensors
#
[value:input_frequency]
oid = .1.3.6.1.2.1.33.1.3.3.1.2.1
func = lambda x: float(x)/10.
name = Input frequency
units = Hz
[value:input_voltage]
oid = .1.3.6.1.2.1.33.1.3.3.1.3.1
name = Input voltage
units = V
[value:input_current]
oid = .1.3.6.1.2.1.33.1.3.3.1.4.1
units = A
name = Input current

21
ini/ups-output.ini Normal file
View File

@ -0,0 +1,21 @@
# UPS with SNMP - tested on Riello
#
# output sensors
#
[value:output_frequency]
oid = .1.3.6.1.2.1.33.1.4.2.0
func = lambda x: float(x)/10.
name = Output frequency
units = Hz
[value:output_voltage]
oid = .1.3.6.1.2.1.33.1.4.4.1.2.1
name = Output voltage
units = V
[value:output_current]
oid = .1.3.6.1.2.1.33.1.4.4.1.3.1
func = lambda x: float(x)/10.
units = A
name = Output current

View File

@ -14,8 +14,6 @@ CRITICAL = 2
UNKNOWN = 3
ERROR = 4
CONFIG = 'pdu.ini'
class Device(object):
def __init__(self, config, host, snmp_community='public'):
self.config = config
@ -49,6 +47,7 @@ class Device(object):
section = 'value:%s' % value
oid = config.get(section, 'oid')
func = config_get(section, 'func', default=None)
label = config_get(section, 'name', default=section)
if not func:
func = lambda x: x
else:
@ -80,7 +79,7 @@ class Device(object):
retv = OK
#
return_str = []
return_str.append('%(value)s = %(cooked)s %(units)s' % \
return_str.append('%(label)s = %(cooked)s %(units)s' % \
locals())
self.extra.append('%(value)s=%(cooked)s%(units)s' % \
locals())