Cleanup config.nodes_of
[check_mk.git] / checks / fireeye_raid
bloba319d7e22e66c5a8ae969504b1dad434fe2c1bf1
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2016 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 # ails. 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 # .1.3.6.1.4.1.25597.11.2.1.1.0 Good --> FE-FIREEYE-MIB::feRaidStatus.0
28 # .1.3.6.1.4.1.25597.11.2.1.2.0 1 --> FE-FIREEYE-MIB::feRaidIsHealthy.0
29 # .1.3.6.1.4.1.25597.11.2.1.3.1.2.1 0
30 # .1.3.6.1.4.1.25597.11.2.1.3.1.2.2 1
31 # .1.3.6.1.4.1.25597.11.2.1.3.1.3.1 Online
32 # .1.3.6.1.4.1.25597.11.2.1.3.1.3.2 Online
33 # .1.3.6.1.4.1.25597.11.2.1.3.1.4.1 1
34 # .1.3.6.1.4.1.25597.11.2.1.3.1.4.2 1
36 # .--RAID----------------------------------------------------------------.
37 # | ____ _ ___ ____ |
38 # | | _ \ / \ |_ _| _ \ |
39 # | | |_) | / _ \ | || | | | |
40 # | | _ < / ___ \ | || |_| | |
41 # | |_| \_\/_/ \_\___|____/ |
42 # | |
43 # +----------------------------------------------------------------------+
44 # | main check |
45 # '----------------------------------------------------------------------'
48 def parse_fireeye_raid(info):
49 # We only discover in case of a raid system
50 parsed = {}
51 if len(info[1]) > 1:
52 for diskname, diskstatus, diskhealth in info[1]:
53 parsed.setdefault("raid", info[0][0])
54 parsed.setdefault("disks", [])
55 parsed["disks"].append([diskname, diskstatus, diskhealth])
57 return parsed
60 def check_fireeye_raid(_no_item, _no_params, parsed):
61 status, health = parsed["raid"]
62 for text, (state, state_readable) in \
63 check_fireeye_states([(status, 'Status'), (health, 'Health')]).items():
64 yield state, "%s: %s" % (text, state_readable)
67 check_info["fireeye_raid"] = {
68 "parse_function" : parse_fireeye_raid,
69 "inventory_function" : lambda parsed: \
70 inventory_fireeye_generic(parsed.get("raid", []), False),
71 "check_function" : check_fireeye_raid,
72 "service_description" : "RAID status",
73 "snmp_info" : [(".1.3.6.1.4.1.25597.11.2.1", [
74 "1", # FE-FIREEYE_MIB::feRaidStatus
75 "2", # FE-FIREEYE_MIB::feRaidIsHealthy
76 ]),
77 (".1.3.6.1.4.1.25597.11.2.1.3.1", [
78 "2", # FE-FIREEYE_MIB::fePhysicalDiskName
79 "3", # FE-FIREEYE_MIB::fePhysicalDiskStatus
80 "4", # FE-FIREEYE_MIB::fePhysicalDiskIsHealthy
81 ])],
82 "snmp_scan_function" : scan_fireeye,
83 "includes" : [ "fireeye.include" ]
87 # .--disks---------------------------------------------------------------.
88 # | _ _ _ |
89 # | __| (_)___| | _____ |
90 # | / _` | / __| |/ / __| |
91 # | | (_| | \__ \ <\__ \ |
92 # | \__,_|_|___/_|\_\___/ |
93 # | |
94 # '----------------------------------------------------------------------'
97 def check_fireeye_raid_disks(item, _no_params, parsed):
98 for diskname, diskstatus, diskhealth in parsed["disks"]:
99 if diskname == item:
100 for text, (state, state_readable) in \
101 check_fireeye_states([(diskstatus, 'Disk status'), (diskhealth, 'Health')]).items():
102 yield state, "%s: %s" % (text, state_readable)
105 check_info["fireeye_raid.disks"] = {
106 "inventory_function" : lambda parsed: \
107 inventory_fireeye_generic(parsed.get("disks", []), True),
108 "check_function" : check_fireeye_raid_disks,
109 "service_description" : "Disk status %s",
110 "includes" : [ "fireeye.include" ]