Refactoring: Changed remaining check parameters starting with an 's' to the new rules...
[check_mk.git] / checks / fsc_sc2_psu
blobe4e03a23290fe92f6e08b4820fdac945ccdb800e
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 # ails. 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.231.2.10.2.2.10.6.2.1.3.1.1 "PSU1"
28 #.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.3.1.2 "PSU2"
29 #.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.5.1.1 3
30 #.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.5.1.2 3
31 #.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.6.1.1 52
32 #.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.6.1.2 40
33 #.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.7.1.1 448
34 #.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.7.1.2 448
37 def inventory_fsc_sc2_psu(info):
38 for line in info:
39 if line[1] not in ["2"]:
40 yield line[0], None
43 def check_fsc_sc2_psu(item, _no_params, info):
44 psu_status = {
45 '1': (3, 'Status is unknown'),
46 '2': (1, 'Status is not-present'),
47 '3': (0, 'Status is ok'),
48 '4': (2, 'Status is failed'),
49 '5': (2, 'Status is ac-fail'),
50 '6': (2, 'Status is dc-fail'),
51 '7': (2, 'Status is critical-temperature'),
52 '8': (1, 'Status is not-manageable'),
53 '9': (1, 'Status is fan-failure-predicted'),
54 '10': (2, 'Status is fan-failure'),
55 '11': (1, 'Status is power-safe-mode'),
56 '12': (1, 'Status is non-redundant-dc-fail'),
57 '13': (1, 'Status is non-redundant-ac-fail')
60 for designation, status, load, nominal in info:
61 if designation == item:
62 yield psu_status.get(status, (3, 'Status is unknown'))
63 if nominal and load:
64 infotext = 'Nominal load: %s W, Actual load: %s W' % (nominal, load)
65 perfdata = [('power', int(load))]
66 else:
67 infotext = 'Did not receive load data'
68 perfdata = []
69 yield 0, infotext, perfdata
72 check_info["fsc_sc2_psu"] = {
73 'inventory_function': inventory_fsc_sc2_psu,
74 'check_function': check_fsc_sc2_psu,
75 'service_description': 'FSC %s',
76 'snmp_info': (
77 '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1',
79 '3', #sc2PowerSupplyDesignation
80 '5', #sc2PowerSupplyStatus
81 '6', #sc2psPowerSupplyLoad
82 '7', #sc2psPowerSupplyNominal
83 ]),
84 'snmp_scan_function': is_fsc_sc2,
85 'has_perfdata': True,
86 'includes': ['fsc.include'],