Refactoring: Changed remaining check parameters starting with an 's' to the new rules...
[check_mk.git] / checks / solaris_fmadm
blob548dada17bfc246e824dd20a860f175da2365a98
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2015 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 # No faults:
28 # Agent section is empty
30 # From https://docs.oracle.com/cd/E23824_01/html/821-1451/glisy.html
31 # One fault:
32 # <<<solaris_fmadm:sep(58)>>>
33 # --------------- ------------------------------------ -------------- ---------
34 # TIME EVENT-ID MSG-ID SEVERITY
35 # --------------- ------------------------------------ -------------- ---------
36 # Aug 24 17:56:03 7b83c87c-78f6-6a8e-fa2b-d0cf16834049 SUN4V-8001-8H Minor
38 # Host : bur419-61
39 # Platform : SUNW,T5440 Chassis_id : BEL07524BN
40 # Product_sn : BEL07524BN
42 # Fault class : fault.cpu.ultraSPARC-T2plus.ireg
43 # Affects : cpu:///cpuid=0/serial=1F95806CD1421929
44 # faulted and taken out of service
45 # FRU : "MB/CPU0" (hc://:product-id=SUNW,T5440:server-id=bur419-61:\
46 # serial=3529:part=541255304/motherboard=0/cpuboard=0)
47 # faulty
48 # Serial ID. : 3529
49 # 1F95806CD1421929
51 # Description : The number of integer register errors associated with this thread
52 # has exceeded acceptable levels.
54 # Response : The fault manager will attempt to remove the affected thread from
55 # service.
57 # Impact : System performance may be affected.
59 # Action : Use 'fmadm faulty' to provide a more detailed view of this event.
60 # Please refer to the associated reference document at
61 # http://sun.com/msg/SUN4V-8001-8H for the latest service
62 # procedures and policies regarding this diagnosis.
64 # Multiple faults:
65 # <<<solaris_fmadm:sep(58)>>>
66 # --------------- ------------------------------------ -------------- -------
67 # TIME EVENT-ID MSG-ID SEVERITY
68 # --------------- ------------------------------------ -------------- -------
69 # Sep 21 10:01:36 d482f935-5c8f-e9ab-9f25-d0aaafec1e6c PCIEX-8000-5Y Major
71 # Fault class : fault.io.pci.device-invreq
72 # Affects : dev:///pci@0,0/pci1022,7458@11/pci1000,3060@0
73 # dev:///pci@0,0/pci1022,7458@11/pci1000,3060@1
74 # ok and in service
75 # dev:///pci@0,0/pci1022,7458@11/pci1000,3060@2
76 # dev:///pci@0,0/pci1022,7458@11/pci1000,3060@3
77 # faulty and taken out of service
78 # FRU : "SLOT 2" (hc://.../pciexrc=3/pciexbus=4/pciexdev=0)
79 # repair attempted
80 # "SLOT 3" (hc://.../pciexrc=3/pciexbus=4/pciexdev=1)
81 # acquitted
82 # "SLOT 4" (hc://.../pciexrc=3/pciexbus=4/pciexdev=2)
83 # not present
84 # "SLOT 5" (hc://.../pciexrc=3/pciexbus=4/pciexdev=3)
85 # faulty
87 # Description : The transmitting device sent an invalid request.
89 # Response : One or more device instances may be disabled
91 # Impact : Possible loss of services provided by the device instances
92 # associated with this fault
94 # Action : Use 'fmadm faulty' to provide a more detailed view of this event.
95 # Please refer to the associated reference document at
96 # http://sun.com/msg/PCIEX-8000-5Y for the latest service
97 # procedures and policies regarding this diagnosis.
99 # Newer outputs:
100 # <<<solaris_fmadm:sep(58)>>>
101 # --------------- ------------------------------------ -------------- ---------
102 # TIME EVENT-ID MSG-ID SEVERITY
103 # --------------- ------------------------------------ -------------- ---------
104 # Jun 05 22:11:06 66b65c7f-33c4-4625-94dc-b35e1926ab47 PCIEX-8000-YJ Major
106 # Problem Status : isolated
107 # Diag Engine : eft / 1.16
108 # System
109 # Manufacturer : unknown
110 # Name : SPARC-Enterprise-M4000-Server
111 # Part_Number : unknown
112 # Serial_Number : BCF1030049
113 # Host_ID : 856ec4fa
115 # ----------------------------------------
116 # Suspect 1 of 3 :
117 # Problem class : fault.io.pciex.device-pcie-ce
118 # Certainty : 40%
119 # Affects : dev:////pci@0,600000/pci@0/pci@9/SUNW,emlxs@0
120 # Status : faulted and taken out of service
122 # FRU
123 # Status : faulty
124 # Location : "/SYS/iou#0-pci#1"
125 # Manufacturer : unknown
126 # Name : unknown
127 # Part_Number : unknown
128 # Revision : unknown
129 # Serial_Number : unknown
130 # Chassis
131 # Manufacturer : unknown
132 # Name : SPARC-Enterprise-M4000-Server
133 # Part_Number : unknown
134 # Serial_Number : BCF1030049
135 # ----------------------------------------
136 # Suspect 2 of 3 :
137 # Problem class : fault.io.pciex.device-pcie-ce
138 # Certainty : 40%
139 # Affects : dev:////pci@0,600000/pci@0/pci@9
140 # Status : faulted and taken out of service
142 # FRU
143 # Status : faulty
144 # FMRI : "hc:///compon"nt=iou#0"
145 # Manufacturer : unknown
146 # Name : unknown
147 # Part_Number : unknown
148 # Revision : unknown
149 # Serial_Number : unknown
150 # Chassis
151 # Manufacturer : unknown
152 # Name : unknown
153 # Part_Number : unknown
154 # Serial_Number : unknown
155 # Resource
156 # Location : "iou#0-pci#1"
157 # ...
160 def parse_solaris_fmadm(info):
161 if len(info) < 4:
162 return {}
164 event = []
165 for entry in ":".join(info[3]).split():
166 if entry:
167 event.append(entry)
169 parsed = {
170 "event": {
171 "time": " ".join(event[:-3]),
172 "id": event[-3],
173 "msg": event[-2],
174 "severity": event[-1].lower(),
176 "problems": [],
179 # Skip header
180 for line in info[4:]:
181 stripped = [x.strip() for x in line]
182 if stripped[0] in ["Problem class", "Fault class"]:
183 parsed["problems"].append(":".join(stripped[1:]))
185 return parsed
188 def inventory_solaris_fmadm(parsed):
189 return [(None, None)]
192 def check_solaris_fmadm(_no_item, params, parsed):
193 if not parsed:
194 yield 0, "No faults detected"
195 return
197 map_state = {
198 "minor": (1, "minor"),
199 "major": (2, "major"),
200 "critical": (2, "critical"),
203 event = parsed["event"]
204 state, state_readable = map_state.get(event["severity"], (3, "unknown"))
205 yield state, "Severity: %s (%s)" % (state_readable, event["time"])
207 problems = parsed["problems"]
208 if problems:
209 yield 0, "Problems: %s" % ", ".join(problems)
212 check_info['solaris_fmadm'] = {
213 'parse_function': parse_solaris_fmadm,
214 'inventory_function': inventory_solaris_fmadm,
215 'check_function': check_solaris_fmadm,
216 'service_description': 'FMD Status',