Cleanup config.nodes_of
[check_mk.git] / checks / blade_bx_blades
blobf7186f4c4ced345b05f523340699ba161673ec95
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_blade_bx_blades(info):
29 for id_, status, _serial, _name in info:
30 if status != "3": # blade not present
31 yield id_, None
34 def check_blade_bx_blades(item, _no_params, info):
35 status_codes = {
36 "1": (3, "unknown"),
37 "2": (0, "OK"),
38 "3": (3, "not present"),
39 "4": (2, "error"),
40 "5": (2, "critical"),
41 "6": (0, "standby"),
44 for id_, status, serial, name in info:
45 if id_ == item:
46 state, state_readable = status_codes[status]
47 if name:
48 name_info = "[%s, Serial: %s]" % (name, serial)
49 else:
50 name_info = "[Serial: %s]" % serial
51 return state, "%s Status: %s" % (name_info, state_readable)
54 check_info['blade_bx_blades'] = {
55 "inventory_function" : inventory_blade_bx_blades,
56 "check_function" : check_blade_bx_blades,
57 "service_description" : "Blade %s",
58 "snmp_info" : (".1.3.6.1.4.1.7244.1.1.1.4.2.1.1", [
59 1, # bladeId
60 2, # bladestatus
61 5, # Serialnumber
62 21, # Name
63 ]),
64 "snmp_scan_function" : lambda oid: "BX600" in oid(".1.3.6.1.2.1.1.1.0") \
65 or oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.7244.1.1.1",