2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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.
28 # Catalog XenApp - Standard - RZ5
29 # Controller rx2345.extern.foobar
30 # DesktopGroupName XenApp - Standard
32 # HostingServer rz1tgn03.extern.foobar
33 # MaintenanceMode False
35 # RegistrationState Registered
36 # VMToolsState Running
37 # AgentVersion 7.6.0.5026
40 def parse_citrix_state(info
):
45 if line
[0] == "Controller":
46 parsed
["controller"] = " ".join(line
[1:])
47 elif line
[0] == "HostingServer":
48 parsed
["hosting_server"] = " ".join(line
[1:])
50 "FaultState", "MaintenanceMode", "PowerState", "RegistrationState", "VMToolsState"
52 parsed
["instance"][line
[0]] = line
[1]
57 # .--Controller----------------------------------------------------------.
59 # | / ___|___ _ __ | |_ _ __ ___ | | | ___ _ __ |
60 # | | | / _ \| '_ \| __| '__/ _ \| | |/ _ \ '__| |
61 # | | |__| (_) | | | | |_| | | (_) | | | __/ | |
62 # | \____\___/|_| |_|\__|_| \___/|_|_|\___|_| |
64 # '----------------------------------------------------------------------'
67 def inventory_citrix_state_controller(parsed
):
68 if "controller" in parsed
:
72 def check_citrix_state_controller(_no_item
, _no_params
, parsed
):
73 return 0, parsed
["controller"]
76 check_info
["citrix_state.controller"] = {
77 "inventory_function": inventory_citrix_state_controller
,
78 "check_function": check_citrix_state_controller
,
79 "service_description": "Citrix Controller",
83 # .--Hosting Server------------------------------------------------------.
85 # || | | | ___ ___| |_(_)_ __ __ _ / ___| ___ _ ____ _____ _ __ |
86 # || |_| |/ _ \/ __| __| | '_ \ / _` | \___ \ / _ \ '__\ \ / / _ \ '__| |
87 # || _ | (_) \__ \ |_| | | | | (_| | ___) | __/ | \ V / __/ | |
88 # ||_| |_|\___/|___/\__|_|_| |_|\__, | |____/ \___|_| \_/ \___|_| |
90 # '----------------------------------------------------------------------'
93 def inventory_citrix_state_hosting_server(parsed
):
94 if "hosting_server" in parsed
:
98 def check_citrix_state_hosting_server(_no_item
, _no_params
, parsed
):
99 return 0, parsed
["hosting_server"]
102 check_info
["citrix_state.hosting_server"] = {
103 "inventory_function": inventory_citrix_state_hosting_server
,
104 "check_function": check_citrix_state_hosting_server
,
105 "service_description": "Citrix Hosting Server",
109 # .--State---------------------------------------------------------------.
111 # | / ___|| |_ __ _| |_ ___ |
112 # | \___ \| __/ _` | __/ _ \ |
113 # | ___) | || (_| | || __/ |
114 # | |____/ \__\__,_|\__\___| |
116 # '----------------------------------------------------------------------'
119 def inventory_citrix_state(parsed
):
120 if parsed
["instance"]:
124 def check_citrix_state(_no_item
, params
, parsed
):
146 "registrationstate": {
160 map_states
.update(params
)
161 for state_type
, state
in parsed
["instance"].items():
162 state_key
= state_type
.lower()
163 if state_key
in map_states
:
164 yield map_states
[state_key
][state
], "%s: %s" % (state_type
, state
)
167 check_info
["citrix_state"] = {
168 "parse_function": parse_citrix_state
,
169 "inventory_function": inventory_citrix_state
,
170 "check_function": check_citrix_state
,
171 "service_description": "Citrix Instance State",
172 "group": "citrix_state",