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 parse_ibm_svc_portsas(info
):
66 for id_
, rows
in parse_ibm_svc_with_header(info
, dflt_header
).iteritems():
71 if "node_id" in data
and "adapter_location" in data
and "adapter_port_id" in data
:
72 item_name
= "Node %s Slot %s Port %s" % (data
['node_id'], data
['adapter_location'],
73 data
['adapter_port_id'])
75 item_name
= "Port %s" % id_
76 parsed
.setdefault(item_name
, data
)
80 def inventory_ibm_svc_portsas(parsed
):
81 for item_name
, data
in parsed
.iteritems():
82 status
= data
['status']
83 if status
== 'offline_unconfigured':
85 yield item_name
, {'current_state': status
}
89 def check_ibm_svc_portsas(item
, params
, data
):
90 # This can be removed soon, because the age of the check
91 # was only about 7 days:
93 params
= {'current_state': 'offline'}
95 sasport_status
= data
['status']
97 infotext
= "Status: %s" % sasport_status
98 if sasport_status
== params
['current_state']:
103 infotext
+= ", Speed: %s, Type: %s" % (data
['port_speed'], data
['type'])
105 return state
, infotext
108 check_info
["ibm_svc_portsas"] = {
109 "parse_function": parse_ibm_svc_portsas
,
110 "check_function": check_ibm_svc_portsas
,
111 "inventory_function": inventory_ibm_svc_portsas
,
112 "service_description": "SAS %s",
113 "includes": ["ibm_svc.include"],