Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / cisco_ucs_mem
blob659c4a530b36e5c1eea7daede9b8e8f7c1200461
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2018 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 # comNET GmbH, Fabian Binder - 2018-05-08
29 # .1.3.6.1.4.1.9.9.719.1.30.11.1.3 cucsMemoryUnitRn
30 # .1.3.6.1.4.1.9.9.719.1.30.11.1.19 cucsMemoryUnitSerial
31 # .1.3.6.1.4.1.9.9.719.1.30.11.1.23 cucsMemoryUnitType
32 # .1.3.6.1.4.1.9.9.719.1.30.11.1.6 cucsMemoryUnitCapacity
33 # .1.3.6.1.4.1.9.9.719.1.30.11.1.14 cucsMemoryUnitOperability
34 # .1.3.6.1.4.1.9.9.719.1.30.11.1.17 cucsMemoryUnitPresence
36 map_memtype = {
37 '0': (0, "undiscovered"),
38 '1': (0, "other"),
39 '2': (0, "unknown"),
40 '3': (0, "dram"),
41 '4': (0, "edram"),
42 '5': (0, "vram"),
43 '6': (0, "sram"),
44 '7': (0, "ram"),
45 '8': (0, "rom"),
46 '9': (0, "flash"),
47 '10': (0, "eeprom"),
48 '11': (0, "feprom"),
49 '12': (0, "eprom"),
50 '13': (0, "cdram"),
51 '14': (0, "n3DRAM"),
52 '15': (0, "sdram"),
53 '16': (0, "sgram"),
54 '17': (0, "rdram"),
55 '18': (0, "ddr"),
56 '19': (0, "ddr2"),
57 '20': (0, "ddr2FbDimm"),
58 '24': (0, "ddr3"),
59 '25': (0, "fbd2"),
60 '26': (0, "ddr4"),
64 def inventory_cisco_ucs_mem(info):
65 for name, _serial, _memtype, _capacity, _status, presence in info:
66 if presence != '11': # do not discover missing units
67 yield name, None
70 def check_cisco_ucs_mem(item, _no_params, info):
71 for name, serial, memtype, capacity, status, presence in info:
72 if name == item:
73 state, state_readable = map_operability.get(status,
74 (3, "Unknown, status code %s" % status))
75 presence_state, presence_readable = map_presence.get(
76 presence, (3, "Unknown, status code %s" % presence))
77 memtype_state, memtype_readable = map_memtype.get(
78 memtype, (3, "Unknown memory type %s" % memtype))
79 yield state, "Status: %s" % state_readable
80 yield presence_state, "Presence: %s" % presence_readable
81 yield memtype_state, "Type: %s" % memtype_readable
82 yield 0, "Size: %s MB, SN: %s" % (capacity, serial)
85 check_info["cisco_ucs_mem"] = {
86 "check_function": check_cisco_ucs_mem,
87 "inventory_function": inventory_cisco_ucs_mem,
88 "service_description": "Memory %s",
89 "snmp_scan_function": scan_cisco_ucs,
90 "snmp_info": (
91 ".1.3.6.1.4.1.9.9.719.1.30.11.1",
93 "3", # cucsMemoryUnitRn
94 "19", # cucsMemoryUnitSerial
95 "23", # cucsMemoryUnitType
96 "6", # cucsMemoryUnitCapacity
97 "14", # cucsMemoryUnitOperability
98 "17", # cucsMemoryUnitPresence
99 ]),
100 "includes": ["cisco_ucs.include"]