GUI CSS: Removed snapin styles from py modules and added a _snapins.scss for the...
[check_mk.git] / checks / ibm_imm_voltage
blob5ab429c974f69fb912b5a92a0f9854e1a5f4e193
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 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.
28 def inventory_ibm_imm_voltage(info):
29 for line in info:
30 yield line[0], None
33 def check_ibm_imm_voltage(item, _no_params, info):
34 for line in info:
35 if line[0] == item:
36 volt, crit, warn, crit_low, warn_low = [float(v) / 1000 for v in line[1:]]
37 infotext = "%.2f Volt" % volt
39 perfdata = [("volt", volt, str(warn_low) + ":" + str(warn),
40 str(crit_low) + ":" + str(crit))]
41 levelstext = " (levels warn/crit lower: %.1f/%.1f upper: %.1f/%.1f)" % (
42 warn_low, crit_low, warn, crit)
44 if (crit_low and volt <= crit_low) or (crit and volt >= crit):
45 state = 2
46 infotext += levelstext
47 elif (warn_low and volt <= warn_low) or (warn and volt >= warn):
48 state = 1
49 infotext += levelstext
50 else:
51 state = 0
53 return state, infotext, perfdata
55 check_info["ibm_imm_voltage"] = {
56 'check_function' : check_ibm_imm_voltage,
57 'inventory_function' : inventory_ibm_imm_voltage,
58 'service_description' : 'Voltage %s',
59 'has_perfdata' : True,
60 'snmp_scan_function' :
61 lambda oid: oid('.1.3.6.1.2.1.1.1.0').lower().endswith(" mips") or \
62 oid('.1.3.6.1.2.1.1.1.0').lower().endswith(" sh4a"),
63 'snmp_info' : ('.1.3.6.1.4.1.2.3.51.3.1.2.2.1', [ # voltTable.voltEntry
64 #1, # voltIndex
65 2, # voltDescr
66 3, # voltReading
67 #4, # voltNominalReading
68 #5, # voltNonRecovLimitHigh
69 6, # voltCritLimitHigh
70 7, # voltNonCritLimitHigh
71 #8, # voltNonRecovLimitLow
72 9, # voltCritLimitLow
73 10, # voltNonCritLimitLow
74 ]),