From 18f68d4e360945474758275938b573dc6bda299c Mon Sep 17 00:00:00 2001 From: Veros Kaplan Date: Mon, 3 Mar 2014 17:53:22 +0100 Subject: [PATCH] Added UPS SNMP values --- ini/ups-battery.ini | 23 +++++++++++++++++++++++ ini/ups-input.ini | 20 ++++++++++++++++++++ ini/ups-output.ini | 21 +++++++++++++++++++++ src/check_snmp_tortilla | 5 ++--- 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 ini/ups-battery.ini create mode 100644 ini/ups-input.ini create mode 100644 ini/ups-output.ini diff --git a/ini/ups-battery.ini b/ini/ups-battery.ini new file mode 100644 index 0000000..2681a93 --- /dev/null +++ b/ini/ups-battery.ini @@ -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 diff --git a/ini/ups-input.ini b/ini/ups-input.ini new file mode 100644 index 0000000..c739a09 --- /dev/null +++ b/ini/ups-input.ini @@ -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 diff --git a/ini/ups-output.ini b/ini/ups-output.ini new file mode 100644 index 0000000..9ac4d9f --- /dev/null +++ b/ini/ups-output.ini @@ -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 diff --git a/src/check_snmp_tortilla b/src/check_snmp_tortilla index e2f4e0d..fe81487 100755 --- a/src/check_snmp_tortilla +++ b/src/check_snmp_tortilla @@ -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())