Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / liebert_pump
blob353043e08fa3d32c842cd06e50838c9e179103a2
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2017 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
27 # example output
28 # .1.3.6.1.4.1.476.1.42.3.9.20.1.10.1.2.1.5298.1 Pump Hours
29 # .1.3.6.1.4.1.476.1.42.3.9.20.1.10.1.2.1.5298.2 Pump Hours
30 # .1.3.6.1.4.1.476.1.42.3.9.20.1.20.1.2.1.5298.1 3423
31 # .1.3.6.1.4.1.476.1.42.3.9.20.1.20.1.2.1.5298.2 1
32 # .1.3.6.1.4.1.476.1.42.3.9.20.1.30.1.2.1.5298.1 hr
33 # .1.3.6.1.4.1.476.1.42.3.9.20.1.30.1.2.1.5298.2 hr
34 # .1.3.6.1.4.1.476.1.42.3.9.20.1.10.1.2.1.5299.1 Pump Hours Threshold
35 # .1.3.6.1.4.1.476.1.42.3.9.20.1.10.1.2.1.5299.2 Pump Hours Threshold
36 # .1.3.6.1.4.1.476.1.42.3.9.20.1.20.1.2.1.5299.1 32000
37 # .1.3.6.1.4.1.476.1.42.3.9.20.1.20.1.2.1.5299.2 32000
38 # .1.3.6.1.4.1.476.1.42.3.9.20.1.30.1.2.1.5299.1 hr
39 # .1.3.6.1.4.1.476.1.42.3.9.20.1.30.1.2.1.5299.2 hr
42 def inventory_liebert_pump(parsed):
43 for key, values in parsed.iteritems():
44 if "threshold" in key.lower():
45 continue
46 elif not "Unavailable" in values[0]:
47 yield (key, {})
50 def check_liebert_pump(item, params, parsed):
51 for key, values in parsed.iteritems():
52 if "Threshold" in key and key.replace(" Threshold", "") == item:
53 crit = int(values[0])
55 for key, values in parsed.iteritems():
56 if key == item and not "Unavailable" in values[0]:
57 value = int(values[0])
58 unit = values[1]
59 yield 0, "%s %s" % (value, unit)
61 if value >= crit:
62 yield 2, "(Threshold at %s %s)" % (crit, unit)
65 check_info['liebert_pump'] = {
66 'parse_function': parse_liebert,
67 'inventory_function': inventory_liebert_pump,
68 'check_function': check_liebert_pump,
69 'service_description': '%s',
70 'snmp_info': (
71 '.1.3.6.1.4.1.476.1.42.3.9.20.1',
73 '10.1.2.1.5298', #LIEBERT-GP-FLExible-MIB: lgpFlexibleEntryDataLabel
74 '20.1.2.1.5298', #LIEBERT-GP-FLExible-MIB: lgpFlexibleEntryValue
75 '30.1.2.1.5298', #LIEBERT-GP-FLExible-MIB: lgpFlexibleEntryUnitsOfMeasure
76 '10.1.2.1.5299', #LIEBERT-GP-FLExible-MIB: lgpFlexibleEntryDataLabel
77 '20.1.2.1.5299', #LIEBERT-GP-FLExible-MIB: lgpFlexibleEntryValue
78 '30.1.2.1.5299', #LIEBERT-GP-FLExible-MIB: lgpFlexibleEntryUnitsOfMeasure
79 ]),
80 'snmp_scan_function': scan_liebert,
81 'includes': ['liebert.include'],
82 'has_perfdata': True,