Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Monitoring
Checkmk
Commits
eb669a08
Commit
eb669a08
authored
May 15, 2022
by
Moritz Kiemer
Browse files
migrate citrix inventory plugins
Change-Id: I103b8f521c96d62d64a1b22ee6a521df969287db
parent
f4aa1a5c
Changes
5
Hide whitespace changes
Inline
Side-by-side
cmk/base/plugins/agent_based/inventory_citrix_controller.py
0 → 100644
View file @
eb669a08
#!/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
,
)
cmk/base/plugins/agent_based/inventory_citrix_state.py
0 → 100644
View file @
eb669a08
#!/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
,
)
inventory/citrix_controller
deleted
100644 → 0
View file @
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.
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
,
}
inventory/citrix_state
deleted
100644 → 0
View file @
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.
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
,
}
tests/unit/cmk/base/plugins/agent_based/test_section_properties.py
View file @
eb669a08
...
...
@@ -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"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment