Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / dell_om_mem
blob2b6b2816c2d7ecf6d5cba349a9e90497c624a75a
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_om_mem(info):
29 return [(x[0], None) for x in info]
32 # DellMemoryDeviceFailureModes ::= INTEGER {
33 # -- Note: These values are bit masks, so combination values are possible.
34 # -- If value is 0 (zero), memory device has no faults.
35 # eccSingleBitCorrectionWarningRate(1), -- ECC single bit correction warning rate exceeded
36 # eccSingleBitCorrectionFailureRate(2), -- ECC single bit correction failure rate exceeded
37 # eccMultiBitFault(4), -- ECC multibit fault encountered
38 # eccSingleBitCorrectionLoggingDisabled(8), -- ECC single bit correction logging disabled
39 # deviceDisabledBySpareActivation(16) -- device disabled because of spare activation
42 def check_dell_om_mem(item, _no_params, info):
43 failure_modes = {
44 1: 'ECC single bit correction warning rate exceeded',
45 2: 'ECC single bit correction failure rate exceeded',
46 4: 'ECC multibit fault encountered',
47 8: 'ECC single bit correction logging disabled',
48 16: 'device disabled because of spare activation',
51 for location, status, size, failuremode in info:
52 if location == item:
53 status = int(status)
54 failuremode = int(failuremode)
55 if failuremode == 0:
56 yield 0, "No failure"
57 else:
58 bitmask = 1
59 while bitmask <= 16:
60 if failuremode & bitmask != 0:
61 if bitmask in [2, 4]:
62 yield 2, failure_modes[bitmask]
63 elif bitmask in [1, 8, 16]:
64 yield 1, failure_modes[bitmask]
65 bitmask *= 2
67 yield 0, "Size: %s" % get_bytes_human_readable(int(size) * 1024)
70 check_info["dell_om_mem"] = {
71 "check_function": check_dell_om_mem,
72 "inventory_function": inventory_dell_om_mem,
73 "service_description": "Memory Module %s",
74 # There is no other way to find out that openmanage is present.
75 "snmp_scan_function": scan_dell_om,
76 "snmp_info": (
77 ".1.3.6.1.4.1.674.10892.1.1100.50.1",
79 "8.1", # Location
80 "5.1", # Status
81 "14.1", # Size
82 "20.1", # FailureMode
83 ]),
84 "includes": ["dell_om.include"],