diff --git a/README.md b/README.md index 14c416a36fe58c7fca590ac33ad0931d11453a60..9ccee5f9eccc5c54b553ef60322985f4d8d7478a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[PACKAGE]: ../../raw/master/mkp/vsphere_topo-0.0.9-20250116.mkp "vsphere_topo-0.0.9-20250116.mkp" +[PACKAGE]: ../../raw/master/mkp/vsphere_topo-0.1.0-20250222.mkp "vsphere_topo-0.1.0-20250222.mkp" # vSphere Topology Visualization This plugin uses the data from the _VMware ESX via vSphere_ special agent to create a topology of the vSphere environment.\ diff --git a/mkp/vsphere_topo-0.1.0-20250222.mkp b/mkp/vsphere_topo-0.1.0-20250222.mkp new file mode 100644 index 0000000000000000000000000000000000000000..23979032d346c76d7070473dbad8cef938b2454b Binary files /dev/null and b/mkp/vsphere_topo-0.1.0-20250222.mkp differ diff --git a/source/cmk_addons_plugins/vsphere_topo/agent_based/vsphere_topo.py b/source/cmk_addons_plugins/vsphere_topo/agent_based/vsphere_topo.py index b17f2980c4a9e16adc1b3cfec930b9ad01122a06..b1935a1ed5e1a4492ea10ba84fbcc93f035159b4 100644 --- a/source/cmk_addons_plugins/vsphere_topo/agent_based/vsphere_topo.py +++ b/source/cmk_addons_plugins/vsphere_topo/agent_based/vsphere_topo.py @@ -23,8 +23,10 @@ # added option to ignore VMs by name (regex) # 2024-07-31: added option to map vSphere names to CMK/topology names for data center, cluster, hosts and VMs # 2024-08-06: fixed crash on mapping vm_name -# 2024-01-16: added suffix option +# 2024-01-16: added suffix option ThX to Thomas Kloppholz # refactored constants to enum +# 2024-02-22: link cluster object to core -> needs mapped name +# reordered output check details from collections.abc import Mapping, Sequence from re import compile as re_compile @@ -132,18 +134,14 @@ def check_vsphere_topo( esx_name = name_map.get(esx_name, esx_name) objects.add_host(host=esx_name) connections.add_connection(cluster, esx_name) - yield Result( - state=State.OK, - notice='VMware ESX via vSphere agent type of query: Queried host is the vCenter' - ) + query_type = 'VMware ESX via vSphere agent type of query: Queried host is the vCenter' + else: # assuming the query type is ESXi host raw_vsphere_host: str = host_name().strip() objects.add_host(host=raw_vsphere_host) vsphere_host = raw_vsphere_host - yield Result( - state=State.OK, - notice='VMware ESX via vSphere agent type of query: Queried host is a host system' - ) + query_type = 'VMware ESX via vSphere agent type of query: Queried host is a host system' + if section_esx_vsphere_virtual_machines is not None: __VMs = [ @@ -270,10 +268,7 @@ def check_vsphere_topo( yield Result(state=State.OK, summary=f'Ignored powered off VMs: {ignored_powered_off_vms}') if re_ignore_vms is not None: yield Result(state=State.OK, summary=f'Ignored VMs by name: {ignored_by_name_vms}') - yield Result( - state=State.OK, - notice=f'Written to: {BASE_TOPO_PATH}/{raw_vsphere_host}/data_{TOPOLOGY_NAME.lower()}.json', - ) + yield from check_levels( value=(time_ns() - start_time) / 1e9, label='Time taken', @@ -281,6 +276,11 @@ def check_vsphere_topo( boundaries=(0, None), render_func=render.timespan, ) + yield Result(state=State.OK, notice=query_type) + yield Result( + state=State.OK, + notice=f'Written to: {BASE_TOPO_PATH}/{raw_vsphere_host}/data_{TOPOLOGY_NAME.lower()}.json', + ) check_plugin_vsphere_topo = CheckPlugin( diff --git a/source/packages/vsphere_topo b/source/packages/vsphere_topo index 2275e41cadd6e27029c124d6ef26e8b90bc76028..aab478d618814fad5e16045b73238f4b2afb5fa3 100644 --- a/source/packages/vsphere_topo +++ b/source/packages/vsphere_topo @@ -13,7 +13,7 @@ 'vsphere_topo/rulesets/vsphere_topo.py']}, 'name': 'vsphere_topo', 'title': 'vSphere Topology', - 'version': '0.0.9-20250116', + 'version': '0.1.0-20250222', 'version.min_required': '2.3.0b1', 'version.packaged': 'cmk-mkp-tool 0.2.0', 'version.usable_until': '2.4.0b1'}