Cleanup config.nodes_of
[check_mk.git] / checks / dell_chassis_slots
blobbfbd73079c2c5ade1f848160bf5bc1ea7009e685
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_dell_chassis_slots(info):
29 inventory = []
30 for line in info:
31 number = line[3]
32 if saveint(number) in (1, 2, 3, 4, 5, 6, 7, 8, 9):
33 number = "0" + number
34 if line[0] != "1" and line[2] != "N/A":
35 inventory.append((number, None))
36 return inventory
39 def check_dell_chassis_slots(item, _no_params, info):
40 for status, service_tag, name, number in info:
41 if saveint(number) in (1, 2, 3, 4, 5, 6, 7, 8, 9):
42 number = "0" + number
43 if item == number:
44 #absent = 1,none = 2,basic = 3,off = 4,
45 state_table = {
46 "1": ("absent", 0),
47 "2": ("none", 1),
48 "3": ("basic", 0),
49 "4": ("off", 1),
51 state_txt, state = state_table.get(status, ("unknown state, ", 3))
52 infotext = "Status: %s, Name: %s, ServiceTag: %s" % (state_txt, name, service_tag)
54 return state, infotext
56 return 3, "unknown slot"
59 check_info["dell_chassis_slots"] = {
60 "check_function": check_dell_chassis_slots,
61 "inventory_function": inventory_dell_chassis_slots,
62 "service_description": "Slot %s",
63 "snmp_info": (
64 ".1.3.6.1.4.1.674.10892.2.5.1.1",
66 #"1", # drsServerIndex
67 "2", # drsServerMonitoringCapable
68 "3", # drsServerServiceTag
69 "4", # drsServerSlotName
70 "5", # drsServerSlotNumber
71 ]),
72 "snmp_scan_function": lambda oid: oid('.1.3.6.1.2.1.1.2.0') == ".1.3.6.1.4.1.674.10892.2",