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.
27 # <<<citrix_controller>>>
28 # ControllerState Active
29 # ControllerVersion 7.6.0.5024
30 # DesktopsRegistered 29
31 # LicensingServerState OK
32 # LicensingGraceState NotActive
33 # ActiveSiteServices RZ2XenPool01 - Cisco UCS VMware
34 # TotalFarmActiveSessions 262
35 # TotalFarmInactiveSessions 14
37 # .--Active Site Services------------------------------------------------.
39 # | / \ ___| |_(_)_ _____ / ___|(_) |_ ___ |
40 # | / _ \ / __| __| \ \ / / _ \ \___ \| | __/ _ \ |
41 # | / ___ \ (__| |_| |\ V / __/ ___) | | || __/ |
42 # | /_/ \_\___|\__|_| \_/ \___| |____/|_|\__\___| |
45 # | / ___| ___ _ ____ _(_) ___ ___ ___ |
46 # | \___ \ / _ \ '__\ \ / / |/ __/ _ \/ __| |
47 # | ___) | __/ | \ V /| | (_| __/\__ \ |
48 # | |____/ \___|_| \_/ |_|\___\___||___/ |
50 # '----------------------------------------------------------------------'
53 def inventory_citrix_controller_services(info
):
55 if line
[0] == "ActiveSiteServices":
59 def check_citrix_controller_services(_no_item
, _no_params
, info
):
61 if line
[0] == "ActiveSiteServices":
62 return 0, " ".join(line
[1:])
65 check_info
["citrix_controller.services"] = {
66 "inventory_function": inventory_citrix_controller_services
,
67 "check_function": check_citrix_controller_services
,
68 "service_description": "Citrix Active Site Services",
72 # .--Desktops Registered-------------------------------------------------.
74 # | | _ \ ___ ___| | _| |_ ___ _ __ ___ |
75 # | | | | |/ _ \/ __| |/ / __/ _ \| '_ \/ __| |
76 # | | |_| | __/\__ \ <| || (_) | |_) \__ \ |
77 # | |____/ \___||___/_|\_\\__\___/| .__/|___/ |
80 # | | _ \ ___ __ _(_)___| |_ ___ _ __ ___ __| | |
81 # | | |_) / _ \/ _` | / __| __/ _ \ '__/ _ \/ _` | |
82 # | | _ < __/ (_| | \__ \ || __/ | | __/ (_| | |
83 # | |_| \_\___|\__, |_|___/\__\___|_| \___|\__,_| |
85 # '----------------------------------------------------------------------'
88 def inventory_citrix_controller_registered(info
):
90 if line
[0] == "DesktopsRegistered":
94 def check_citrix_controller_registered(_no_item
, _no_params
, info
):
96 if line
[0] == "DesktopsRegistered":
97 desktops
= int(line
[1])
98 return 0, "%d" % desktops
, [("registered_desktops", desktops
)]
101 check_info
["citrix_controller.registered"] = {
102 "inventory_function": inventory_citrix_controller_registered
,
103 "check_function": check_citrix_controller_registered
,
104 "service_description": "Citrix Desktops Registered",
105 "has_perfdata": True,
109 # .--Total Sessions------------------------------------------------------.
110 # | _____ _ _ ____ _ |
111 # | |_ _|__ | |_ __ _| | / ___| ___ ___ ___(_) ___ _ __ ___ |
112 # | | |/ _ \| __/ _` | | \___ \ / _ \/ __/ __| |/ _ \| '_ \/ __| |
113 # | | | (_) | || (_| | | ___) | __/\__ \__ \ | (_) | | | \__ \ |
114 # | |_|\___/ \__\__,_|_| |____/ \___||___/___/_|\___/|_| |_|___/ |
116 # '----------------------------------------------------------------------'
119 def inventory_citrix_controller_sessions(info
):
122 inv
= inv
or ("sessions" in line
[0].lower())
129 def check_citrix_controller_sessions(_no_item
, params
, info
):
138 if line
[0] == "TotalFarmActiveSessions":
139 session
["active"] = int(line
[1])
140 elif line
[0] == "TotalFarmInactiveSessions":
141 session
["inactive"] = int(line
[1])
143 session
["total"] = session
["active"] + session
["inactive"]
148 for what
in ['total', 'active', 'inactive']:
149 warn
, crit
= params
.get(what
, (None, None))
150 perf
.append((what
+ "_sessions", session
[what
], warn
, crit
))
151 if crit
is not None and session
[what
] >= crit
:
152 messages
.append("%s: %s(!!)" % (what
, session
[what
]))
154 elif warn
is not None and session
[what
] >= warn
:
155 messages
.append("%s: %s(!)" % (what
, session
[what
]))
156 state
= max(state
, 1)
158 messages
.append("%s: %s" % (what
, session
[what
]))
160 return state
, ", ".join(messages
), perf
163 check_info
["citrix_controller.sessions"] = {
164 "inventory_function": inventory_citrix_controller_sessions
,
165 "check_function": check_citrix_controller_sessions
,
166 "service_description": "Citrix Total Sessions",
167 "has_perfdata": True,
168 "group": "citrix_sessions",
172 # .--Licensing State-----------------------------------------------------.
174 # | | | (_) ___ ___ _ __ ___(_)_ __ __ _ / ___|| |_ __ _| |_ ___ |
175 # | | | | |/ __/ _ \ '_ \/ __| | '_ \ / _` | \___ \| __/ _` | __/ _ \ |
176 # | | |___| | (_| __/ | | \__ \ | | | | (_| | ___) | || (_| | || __/ |
177 # | |_____|_|\___\___|_| |_|___/_|_| |_|\__, | |____/ \__\__,_|\__\___| |
179 # '----------------------------------------------------------------------'
182 def inventory_citrix_controller_licensing(info
):
184 return [(None, None)]
187 def check_citrix_controller_licensing(_no_item
, _no_params
, info
):
190 "licensingserverstate": ("Licensing Server State", {
191 "ServerNotSpecified": (2, "server not specified"),
192 "NotConnected": (1, "not connected"),
194 "LicenseNotInstalled": (2, "license not installed"),
195 "LicenseExpired": (2, "licenese expired"),
196 "Incompatible": (2, "incompatible"),
197 "Failed": (2, "failed"),
199 "licensinggracestate": ("Licensing Grace State", {
200 "NotActive": (0, "not active"),
201 "Active": (2, "active"),
202 "InOutOfBoxGracePeriod": (1, "in-out-of-box grace period"),
203 "InSupplementalGracePeriod": (1, "in-supplemental grace period"),
204 "InEmergencyGracePeriod": (2, "in-emergency grace period"),
205 "GracePeriodExpired": (2, "grace period expired"),
208 # piggy back data might deliver double data
211 if line
[0].lower() in statedict
and line
[0] not in detected_states
:
212 detected_states
.append(line
[0])
213 title
, states
= statedict
[line
[0].lower()]
214 state
, state_readable
= states
[line
[1]]
215 yield state
, "%s: %s" % (title
, state_readable
)
218 check_info
["citrix_controller.licensing"] = {
219 "inventory_function": inventory_citrix_controller_licensing
,
220 "check_function": check_citrix_controller_licensing
,
221 "service_description": "Citrix Controller Licensing",
225 # .--Controller State----------------------------------------------------.
227 # | / ___|___ _ __ | |_ _ __ ___ | | | ___ _ __ |
228 # | | | / _ \| '_ \| __| '__/ _ \| | |/ _ \ '__| |
229 # | | |__| (_) | | | | |_| | | (_) | | | __/ | |
230 # | \____\___/|_| |_|\__|_| \___/|_|_|\___|_| |
233 # | / ___|| |_ __ _| |_ ___ |
234 # | \___ \| __/ _` | __/ _ \ |
235 # | ___) | || (_| | || __/ |
236 # | |____/ \__\__,_|\__\___| |
238 # '----------------------------------------------------------------------'
241 def inventory_citrix_controller(info
):
243 if line
[0] == "ControllerState":
244 return [(None, None)]
247 def check_citrix_controller(_no_item
, _no_params
, info
):
249 if line
[0] == "ControllerState":
251 if line
[1] != "Active":
253 return state
, line
[1]
256 check_info
["citrix_controller"] = {
257 "inventory_function": inventory_citrix_controller
,
258 "check_function": check_citrix_controller
,
259 "service_description": "Citrix Controller State",