Cleanup config.nodes_of
[check_mk.git] / checks / adva_fsp_current
blobdf885155128f6e46c1db0f639c25050e36e4a942
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.
27 # .1.3.6.1.4.1.2544.1.11.2.4.2.2.1.1.101318912 8110
28 # .1.3.6.1.4.1.2544.1.11.2.4.2.2.1.2.101318912 65600
29 # .1.3.6.1.4.1.2544.1.11.2.4.2.2.1.3.101318912 9
30 # .1.3.6.1.4.1.2544.2.5.5.1.1.1.101318912 "PSU/7HU-AC-800"
31 # .1.3.6.1.4.1.2544.2.5.5.1.1.5.101318912 "MOD-1-1"
34 def inventory_adva_fsp_current(info):
35 for _current_str, _upper_threshold_str, power_str, \
36 _unit_name, index_aid in info:
37 # Ignore non-connected sensors
38 if index_aid != "" and power_str != "":
39 yield index_aid, None
42 def check_adva_fsp_current(item, _no_params, info):
43 for current_str, upper_threshold_str, _power_str, \
44 unit_name, index_aid in info:
45 if index_aid == item:
46 current = float(current_str) / 1000.0
47 upper_threshold = float(upper_threshold_str) / 1000
49 infotext = "[%s] %.3f A (crit at %.3f A)" % (unit_name, current, upper_threshold)
50 perfdata = [(
51 "current",
52 current,
53 None,
54 upper_threshold,
57 if current <= 0:
58 return 3, "Invalid sensor data"
59 elif current >= upper_threshold:
60 return 2, infotext, perfdata
61 return 0, infotext, perfdata
64 check_info['adva_fsp_current'] = {
65 "inventory_function": inventory_adva_fsp_current,
66 "check_function": check_adva_fsp_current,
67 "service_description": "Power Supply %s",
68 "has_perfdata": True,
69 "snmp_info": (
70 ".1.3.6.1.4.1.2544",
72 "1.11.2.4.2.2.1.1", # currentDiagnosticsAmpere
73 "1.11.2.4.2.2.1.2", # currentDiagnosticsUpperThres
74 "1.11.2.4.2.2.1.3", # currentDiagnosticsPsuOutputPower
75 "2.5.5.1.1.1", # inventoryUnitName
76 "2.5.5.2.1.5", # entityIndexAid
77 ]),
78 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.1.0") == "Fiber Service Platform F7",