Commit eb669a08 authored by Moritz Kiemer's avatar Moritz Kiemer
Browse files

migrate citrix inventory plugins

Change-Id: I103b8f521c96d62d64a1b22ee6a521df969287db
parent f4aa1a5c
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
from typing import NewType, Optional
from .agent_based_api.v1 import Attributes, register
from .agent_based_api.v1.type_defs import InventoryResult, StringTable
Version = NewType("Version", str)
def parse_citrix_controller(string_table: StringTable) -> Optional[Version]:
for line in string_table:
if line[0] == "ControllerVersion":
return Version(line[1])
return None
register.agent_section(
name="citrix_controller",
parse_function=parse_citrix_controller,
)
def inventory_citrix_controller(section: Version) -> InventoryResult:
yield Attributes(
path=["software", "applications", "citrix", "controller"],
inventory_attributes={
"controller_version": section,
},
)
register.inventory_plugin(
name="citrix_controller",
inventory_function=inventory_citrix_controller,
)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
from typing import Mapping
from .agent_based_api.v1 import Attributes, register
from .agent_based_api.v1.type_defs import InventoryResult, StringTable
Section = Mapping[str, str]
def parse_citrix_state(string_table: StringTable) -> Section:
return {key: " ".join(rest) for key, *rest in string_table}
register.agent_section(
name="citrix_state",
parse_function=parse_citrix_state,
)
def inventory_citrix_state(section: Section) -> InventoryResult:
yield Attributes(
path=["software", "applications", "citrix", "vm"],
inventory_attributes={
k: v
for k, kp in (
("desktop_group_name", "DesktopGroupName"),
("catalog", "Catalog"),
("agent_version", "AgentVersion"),
)
if (v := section.get(kp)) is not None
},
)
register.inventory_plugin(
name="citrix_state",
inventory_function=inventory_citrix_state,
)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
def inv_citrix_controller(info):
node = inv_tree("software.applications.citrix.controller.")
for line in info:
if line[0] == "ControllerVersion":
node["controller_version"] = line[1]
inv_info["citrix_controller"] = {
"inv_function": inv_citrix_controller,
}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
def inv_citrix_state(info):
node = inv_tree("software.applications.citrix.vm.")
for line in info:
if line[0] == "DesktopGroupName":
node["desktop_group_name"] = " ".join(line[1:])
elif line[0] == "Catalog":
node["catalog"] = " ".join(line[1:])
elif line[0] == "AgentVersion":
node["agent_version"] = line[1]
inv_info["citrix_state"] = {
"inv_function": inv_citrix_state,
}
......@@ -136,7 +136,6 @@ def test_section_parse_function_does_something(fix_register):
"appdynamics_web_container",
"arc_raid_status",
"arcserve_backup",
"citrix_controller",
"citrix_serverload",
"citrix_sessions",
"db2_mem",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment