2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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.
27 # Example agent output:
28 # <<<ibm_svc_portsas:sep(58)>>>
29 # 0:1:6Gb:1:node1:500507680305D3C0:online::host:host_controller:0:1
30 # 1:2:6Gb:1:node1:500507680309D3C0:online::host:host_controller:0:2
31 # 2:3:6Gb:1:node1:50050768030DD3C0:online::host:host_controller:0:3
32 # 3:4:6Gb:1:node1:500507680311D3C0:offline:500507680474F03F:none:enclosure:0:4
33 # 4:5:N/A:1:node1:500507680315D3C0:offline_unconfigured::none:host_controller:1:1
34 # 5:6:N/A:1:node1:500507680319D3C0:offline_unconfigured::none:host_controller:1:2
35 # 6:7:N/A:1:node1:50050768031DD3C0:offline_unconfigured::none:host_controller:1:3
36 # 7:8:N/A:1:node1:500507680321D3C0:offline_unconfigured::none:host_controller:1:4
37 # 8:1:6Gb:2:node2:500507680305D3C1:online::host:host_controller:0:1
38 # 9:2:6Gb:2:node2:500507680309D3C1:online::host:host_controller:0:2
39 # 10:3:6Gb:2:node2:50050768030DD3C1:online::host:host_controller:0:3
40 # 11:4:6Gb:2:node2:500507680311D3C1:offline:500507680474F07F:none:enclosure:0:4
41 # 12:5:N/A:2:node2:500507680315D3C1:offline_unconfigured::none:host_controller:1:1
42 # 13:6:N/A:2:node2:500507680319D3C1:offline_unconfigured::none:host_controller:1:2
43 # 14:7:N/A:2:node2:50050768031DD3C1:offline_unconfigured::none:host_controller:1:3
44 # 15:8:N/A:2:node2:500507680321D3C1:offline_unconfigured::none:host_controller:1:4
46 # the corresponding header line
47 #id:port_id:port_speed:node_id:node_name:WWPN:status:switch_WWPN:attachment:type:adapter_location:adapter_port_id
50 def inventory_ibm_svc_portsas(info
):
52 if line
[6] != "offline_unconfigured":
54 item
= "Node %s Slot %s Port %s" % (line
[3], line
[10], line
[11])
55 yield item
, {'current_state': line
[6]}
57 item
= "Port %s" % line
[0]
58 yield item
, {'current_state': line
[6]}
61 def check_ibm_svc_portsas(item
, params
, info
):
62 # This can be removed soon, because the age of the check
63 # was only about 7 days:
65 params
= {'current_state': 'offline'}
67 if ( len(line
) == 12 and item
== "Node %s Slot %s Port %s" % (line
[3], line
[10], line
[11]) ) or \
68 ( len(line
) == 10 and item
== "Port %s" % line
[0] ):
69 sasport_status
= line
[6]
70 sasport_speed
= line
[2]
71 sasport_type
= line
[9]
73 infotext
= "Status: %s" % sasport_status
74 if sasport_status
== params
['current_state']:
79 infotext
+= ", Speed: %s, Type: %s" % (sasport_speed
, sasport_type
)
81 return state
, infotext
84 check_info
["ibm_svc_portsas"] = {
85 "check_function": check_ibm_svc_portsas
,
86 "inventory_function": inventory_ibm_svc_portsas
,
87 "service_description": "SAS %s",