Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / cisco_ucs_hdd
blob72535f7b314d43331efdf453b8198831568ff73f
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-07
29 # .1.3.6.1.4.1.9.9.719.1.45.4.1.9 cucsStorageLocalDiskOperability
30 # .1.3.6.1.4.1.9.9.719.1.45.4.1.6 cucsStorageLocalDiskId
31 # .1.3.6.1.4.1.9.9.719.1.45.4.1.7 cucsStorageLocalDiskModel
32 # .1.3.6.1.4.1.9.9.719.1.45.4.1.14 cucsStorageLocalDiskVendor
33 # .1.3.6.1.4.1.9.9.719.1.45.4.1.13 cucsStorageLocalDiskSize
34 # .1.3.6.1.4.1.9.9.719.1.45.4.1.12 cucsStorageLocalDiskSerial
37 def inventory_cisco_ucs_hdd(info):
38 for status, ident, _model, _vendor, _size, _serial in info:
39 if status != '6': # do not discover removed HDDs
40 yield ident, None
43 def check_cisco_ucs_hdd(item, _no_params, info):
44 for status, ident, model, vendor, size, serial in info:
45 if ident == item:
46 state, state_readable = map_operability.get(status,
47 (3, "Unknown, status code %s" % status))
48 size_readable = get_bytes_human_readable(
49 int(size) * 1024 * 1024) # size is returned in MB
50 return state, "Status: %s, Size: %s, Model: %s, Vendor: %s, SN: %s" % \
51 (state_readable, size_readable, model, vendor, serial)
54 check_info["cisco_ucs_hdd"] = {
55 "check_function": check_cisco_ucs_hdd,
56 "inventory_function": inventory_cisco_ucs_hdd,
57 "service_description": "HDD %s",
58 "snmp_scan_function": scan_cisco_ucs,
59 "snmp_info": (
60 ".1.3.6.1.4.1.9.9.719.1.45.4.1",
62 "9", # cucsStorageLocalDiskOperability
63 "6", # cucsStorageLocalDiskId
64 "7", # cucsStorageLocalDiskModel
65 "14", # cucsStorageLocalDiskVendor
66 "13", # cucsStorageLocalDiskSize
67 "12", # cucsStorageLocalDiskSerial
68 ]),
69 "includes": ["cisco_ucs.include"]