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 3f9a161f authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

update project

parent 5664bdfb
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/vsphere_topo-0.0.1-20240709.mkp "vsphere_topo-0.0.1-20240709.mkp" [PACKAGE]: ../../raw/master/mkp/vsphere_topo-0.0.2-20240709.mkp "vsphere_topo-0.0.2-20240709.mkp"
# vSphere Topology Visualization # vSphere Topology Visualization
This plugin uses the data from the _VMware ESX via vSphere_ spezial agent to create a topolofy of the vSphere environment. This plugin uses the data from the _VMware ESX via vSphere_ spezial agent to create a topolofy of the vSphere environment.
......
File added
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
# Date : 2024-07-05 # Date : 2024-07-05
# File : vsphere_topo/agent_based/packages.py # File : vsphere_topo/agent_based/packages.py
# 2024-07-10: added time taken as metric
from collections.abc import Mapping, Sequence from collections.abc import Mapping, Sequence
from time import time_ns from time import time_ns
from typing import Any from typing import Any
...@@ -19,6 +21,8 @@ from cmk.agent_based.v2 import ( ...@@ -19,6 +21,8 @@ from cmk.agent_based.v2 import (
Result, Result,
Service, Service,
State, State,
check_levels,
render,
) )
from cmk.base.check_api import host_name from cmk.base.check_api import host_name
from cmk_addons.plugins.vsphere_topo.lib.utils import ( from cmk_addons.plugins.vsphere_topo.lib.utils import (
...@@ -273,7 +277,13 @@ def check_vsphere_topo( ...@@ -273,7 +277,13 @@ def check_vsphere_topo(
yield Result(state=State.OK, summary=f'Objects: {len(objects)}') yield Result(state=State.OK, summary=f'Objects: {len(objects)}')
yield Result(state=State.OK, summary=f'Connections: {len(connections)}') yield Result(state=State.OK, summary=f'Connections: {len(connections)}')
yield Result(state=State.OK, notice=f'Written to: {path}/{file}') yield Result(state=State.OK, notice=f'Written to: {path}/{file}')
yield Result(state=State.OK, summary=f'Time taken: {((time_ns() - start_time) / 1e9):.2}/s') yield from check_levels(
value=(time_ns() - start_time) / 1e9,
label='Time taken',
metric_name='vsphere_topo_time_taken',
boundaries=(0, None),
render_func=render.timespan,
)
check_plugin_vsphere_topo = CheckPlugin( check_plugin_vsphere_topo = CheckPlugin(
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# License: GNU General Public License v2
#
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2024-07-10
# File : vsphere_topo/graphing/packages.py
from cmk.graphing.v1 import Title
from cmk.graphing.v1.graphs import Graph
from cmk.graphing.v1.metrics import Color, Metric, Unit, TimeNotation, AutoPrecision
from cmk.graphing.v1.perfometers import Closed, FocusRange, Open, Perfometer
metric_vsphere_topo_time_taken = Metric(
name='vsphere_topo_time_taken',
title=Title('Time taken'),
unit=Unit(TimeNotation(), AutoPrecision(4)),
color=Color.BLUE,
)
graph_vsphere_topo_time_taken = Graph(
name='vsphere_topo_time_taken',
title=Title('Time taken'),
compound_lines=['vsphere_topo_time_taken'],
)
perfometer_vsphere_topo_time_taken = Perfometer(
name='vsphere_topo_time_taken',
focus_range=FocusRange(Closed(0), Open(1)),
segments=['vsphere_topo_time_taken']
)
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
from collections.abc import Mapping, Sequence from collections.abc import Mapping, Sequence
from cmk.rulesets.v1 import Label, Title from cmk.rulesets.v1 import Help, Label, Title
from cmk.rulesets.v1.form_specs import ( from cmk.rulesets.v1.form_specs import (
CascadingSingleChoice, CascadingSingleChoice,
CascadingSingleChoiceElement, CascadingSingleChoiceElement,
...@@ -118,42 +118,70 @@ def _parameter_form() -> Dictionary: ...@@ -118,42 +118,70 @@ def _parameter_form() -> Dictionary:
parameter_form=CascadingSingleChoice( parameter_form=CascadingSingleChoice(
title=Title('Cluster emblem'), title=Title('Cluster emblem'),
elements=get_emblem_element(EMBLEM_CLUSTER), elements=get_emblem_element(EMBLEM_CLUSTER),
prefill=DefaultValue(PARAM_DEFAULT_EMBLEM) prefill=DefaultValue(PARAM_DEFAULT_EMBLEM),
help_text=Help(
'Here you can change the picture for the cluster. If you use the built-in icons prefix '
'the name with "icon_"'
),
)), )),
PARAM_DATA_CENTER: DictElement( PARAM_DATA_CENTER: DictElement(
parameter_form=CascadingSingleChoice( parameter_form=CascadingSingleChoice(
title=Title('Datacenter emblem'), title=Title('Datacenter emblem'),
elements=get_emblem_element(EMBLEM_DATA_CENTER), elements=get_emblem_element(EMBLEM_DATA_CENTER),
prefill=DefaultValue(PARAM_DEFAULT_EMBLEM) prefill=DefaultValue(PARAM_DEFAULT_EMBLEM),
help_text=Help(
'Here you can change the picture for the datacenter. If you use the built-in icons prefix '
'the name with "icon_"'
),
)), )),
PARAM_DATA_STORE: DictElement( PARAM_DATA_STORE: DictElement(
parameter_form=CascadingSingleChoice( parameter_form=CascadingSingleChoice(
title=Title('Datastore emblem'), title=Title('Datastore emblem'),
elements=get_emblem_element(EMBLEM_DATA_STORE), elements=get_emblem_element(EMBLEM_DATA_STORE),
prefill=DefaultValue(PARAM_DEFAULT_EMBLEM) prefill=DefaultValue(PARAM_DEFAULT_EMBLEM),
help_text=Help(
'Here you can change the picture for the datastore. If you use the built-in icons prefix '
'the name with "icon_"'
),
)), )),
PARAM_DATA_STORE_AS_SERVICE: DictElement( PARAM_DATA_STORE_AS_SERVICE: DictElement(
parameter_form=FixedValue( parameter_form=FixedValue(
title=Title('Add data store service'), title=Title('Add data store service'),
label=Label('enabled'), label=Label('enabled'),
help_text=Help(
'This option adds the datastore services from the vCenter object to the topology. '
'Pro: more insight. Con: cluttered topology.'
),
value=True value=True
)), )),
PARAM_MAKE_DEFAULT: DictElement( PARAM_MAKE_DEFAULT: DictElement(
parameter_form=FixedValue( parameter_form=FixedValue(
title=Title('Make default'), title=Title('Make default'),
label=Label('This will be the default topology'), label=Label('This will be the default topology'),
help_text=Help(
'Makes the vSphere topology the default topology. If there no default topology, the vSphere '
'topology becomes always the default.'
),
value=True value=True
)), )),
PARAM_DONT_ADD_VC_AS_VM: DictElement( PARAM_DONT_ADD_VC_AS_VM: DictElement(
parameter_form=FixedValue( parameter_form=FixedValue(
title=Title('Don\'t add vCenter as VM'), title=Title('Don\'t add vCenter as VM'),
label=Label('The vCenter will not be added as VM'), label=Label('The vCenter will not be added as VM'),
help_text=Help(
'Use this option if the vCenter is also a VM within the managed datacenter.'
'This will create a clearer topology, but you lose the info where the vCenter is running.'
),
value=True value=True
)), )),
PARAM_ADD_DUMMY_TOPOLOGIES: DictElement( PARAM_ADD_DUMMY_TOPOLOGIES: DictElement(
parameter_form=FixedValue( parameter_form=FixedValue(
title=Title('Add dummy topologies'), title=Title('Add dummy topologies'),
label=Label('Adds empty CDP, LLDP, L3v4 and STATIC topology'), label=Label('Adds empty CDP, LLDP, L3v4 and STATIC topology'),
help_text=Help(
'Use this option if you are also using the NVDCT. This is a workaround, as the backend '
'only picks up layers that are present in the default topology folder.'
),
value=True value=True
)), )),
} }
......
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
'download_url': 'https://thl-cmk.hopto.org', 'download_url': 'https://thl-cmk.hopto.org',
'files': {'cmk_addons_plugins': ['vsphere_topo/agent_based/packages.py', 'files': {'cmk_addons_plugins': ['vsphere_topo/agent_based/packages.py',
'vsphere_topo/rulesets/packages.py', 'vsphere_topo/rulesets/packages.py',
'vsphere_topo/lib/utils.py']}, 'vsphere_topo/lib/utils.py',
'vsphere_topo/graphing/packages.py']},
'name': 'vsphere_topo', 'name': 'vsphere_topo',
'title': 'vSphere Topologie', 'title': 'vSphere Topologie',
'version': '0.0.1-20240709', 'version': '0.0.2-20240709',
'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