Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit 8efbed9e authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

link cluster object to core

parent 6c65feff
No related branches found
No related tags found
No related merge requests found
[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 # vSphere Topology Visualization
This plugin uses the data from the _VMware ESX via vSphere_ special agent to create a topology of the vSphere environment.\ This plugin uses the data from the _VMware ESX via vSphere_ special agent to create a topology of the vSphere environment.\
......
File added
...@@ -23,8 +23,10 @@ ...@@ -23,8 +23,10 @@
# added option to ignore VMs by name (regex) # 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-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-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 # 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 collections.abc import Mapping, Sequence
from re import compile as re_compile from re import compile as re_compile
...@@ -132,18 +134,14 @@ def check_vsphere_topo( ...@@ -132,18 +134,14 @@ def check_vsphere_topo(
esx_name = name_map.get(esx_name, esx_name) esx_name = name_map.get(esx_name, esx_name)
objects.add_host(host=esx_name) objects.add_host(host=esx_name)
connections.add_connection(cluster, esx_name) connections.add_connection(cluster, esx_name)
yield Result( query_type = 'VMware ESX via vSphere agent type of query: Queried host is the vCenter'
state=State.OK,
notice='VMware ESX via vSphere agent type of query: Queried host is the vCenter'
)
else: # assuming the query type is ESXi host else: # assuming the query type is ESXi host
raw_vsphere_host: str = host_name().strip() raw_vsphere_host: str = host_name().strip()
objects.add_host(host=raw_vsphere_host) objects.add_host(host=raw_vsphere_host)
vsphere_host = raw_vsphere_host vsphere_host = raw_vsphere_host
yield Result( query_type = 'VMware ESX via vSphere agent type of query: Queried host is a host system'
state=State.OK,
notice='VMware ESX via vSphere agent type of query: Queried host is a host system'
)
if section_esx_vsphere_virtual_machines is not None: if section_esx_vsphere_virtual_machines is not None:
__VMs = [ __VMs = [
...@@ -270,10 +268,7 @@ def check_vsphere_topo( ...@@ -270,10 +268,7 @@ def check_vsphere_topo(
yield Result(state=State.OK, summary=f'Ignored powered off VMs: {ignored_powered_off_vms}') yield Result(state=State.OK, summary=f'Ignored powered off VMs: {ignored_powered_off_vms}')
if re_ignore_vms is not None: 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, 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( yield from check_levels(
value=(time_ns() - start_time) / 1e9, value=(time_ns() - start_time) / 1e9,
label='Time taken', label='Time taken',
...@@ -281,6 +276,11 @@ def check_vsphere_topo( ...@@ -281,6 +276,11 @@ def check_vsphere_topo(
boundaries=(0, None), boundaries=(0, None),
render_func=render.timespan, 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( check_plugin_vsphere_topo = CheckPlugin(
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
'vsphere_topo/rulesets/vsphere_topo.py']}, 'vsphere_topo/rulesets/vsphere_topo.py']},
'name': 'vsphere_topo', 'name': 'vsphere_topo',
'title': 'vSphere Topology', 'title': 'vSphere Topology',
'version': '0.0.9-20250116', 'version': '0.1.0-20250222',
'version.min_required': '2.3.0b1', 'version.min_required': '2.3.0b1',
'version.packaged': 'cmk-mkp-tool 0.2.0', 'version.packaged': 'cmk-mkp-tool 0.2.0',
'version.usable_until': '2.4.0b1'} 'version.usable_until': '2.4.0b1'}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment