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 # Example output from agent:
28 # <<<citrix_hostsystem>>>
30 # CitrixPoolName RZ1XenPool01 - Cisco UCS
33 # Note(1): The pool name is the same for all VMs on one host system
34 # Note(2): for the same host and vm this section can appear
35 # several times (with the same content).
36 def parse_citrix_hostsystem(info
):
37 parsed
= {"vms": [], "pool": ""}
39 if line
[0] == "VMName":
40 vm
= " ".join(line
[1:])
41 if vm
not in parsed
["vms"]:
42 parsed
["vms"].append(vm
)
43 elif line
[0] == "CitrixPoolName":
44 pool
= " ".join(line
[1:])
45 if not parsed
["pool"]:
50 # .--Host VMs------------------------------------------------------------.
51 # | _ _ _ __ ____ __ |
52 # | | | | | ___ ___| |_ \ \ / / \/ |___ |
53 # | | |_| |/ _ \/ __| __| \ \ / /| |\/| / __| |
54 # | | _ | (_) \__ \ |_ \ V / | | | \__ \ |
55 # | |_| |_|\___/|___/\__| \_/ |_| |_|___/ |
57 # '----------------------------------------------------------------------'
60 def inventory_citrix_hostsystem_vms(parsed
):
65 def check_citrix_hostsystem_vms(_no_item
, _no_params
, parsed
):
66 vmlist
= parsed
["vms"]
67 return 0, "%d VMs running: %s" % (len(vmlist
), ", ".join(vmlist
))
70 check_info
["citrix_hostsystem.vms"] = {
71 "inventory_function": inventory_citrix_hostsystem_vms
,
72 "check_function": check_citrix_hostsystem_vms
,
73 "service_description": "Citrix VMs",
77 # .--Host Info-----------------------------------------------------------.
79 # | | | | | ___ ___| |_ |_ _|_ __ / _| ___ |
80 # | | |_| |/ _ \/ __| __| | || '_ \| |_ / _ \ |
81 # | | _ | (_) \__ \ |_ | || | | | _| (_) | |
82 # | |_| |_|\___/|___/\__| |___|_| |_|_| \___/ |
84 # '----------------------------------------------------------------------'
87 def inventory_citrix_hostsystem(parsed
):
92 def check_citrix_hostsystem(_no_item
, no_params
, parsed
):
93 return 0, "Citrix Pool Name: %s" % parsed
["pool"]
96 check_info
["citrix_hostsystem"] = {
97 "parse_function": parse_citrix_hostsystem
,
98 "inventory_function": inventory_citrix_hostsystem
,
99 "check_function": check_citrix_hostsystem
,
100 "service_description": "Citrix Host Info",