diff --git a/README.md b/README.md index 6f324021530e09975f7c45a436a6a96663a8e21a..14c416a36fe58c7fca590ac33ad0931d11453a60 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[PACKAGE]: ../../raw/master/mkp/vsphere_topo-0.0.8-20240806.mkp "vsphere_topo-0.0.8-20240806.mkp" +[PACKAGE]: ../../raw/master/mkp/vsphere_topo-0.0.9-20250116.mkp "vsphere_topo-0.0.9-20250116.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.0.9-20250116.mkp b/mkp/vsphere_topo-0.0.9-20250116.mkp new file mode 100644 index 0000000000000000000000000000000000000000..c585d371a7c5406a6320668caf6cbe21f85bad77 Binary files /dev/null and b/mkp/vsphere_topo-0.0.9-20250116.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 0d2f9a468a1e7a1286062774b3bf7bf32358e89f..b17f2980c4a9e16adc1b3cfec930b9ad01122a06 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,11 +23,13 @@ # 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 +# refactored constants to enum + from collections.abc import Mapping, Sequence from re import compile as re_compile from time import time_ns - from cmk.agent_based.v2 import ( CheckPlugin, CheckResult, @@ -40,21 +42,9 @@ from cmk.agent_based.v2 import ( ) from cmk.base.check_api import host_name from cmk_addons.plugins.vsphere_topo.constants import ( - EMBLEM_CLUSTER, - EMBLEM_DATA_CENTER, - EMBLEM_DATA_STORE, + Emblem, ICON_VCENTER, - PARAM_CLUSTER, - PARAM_DATA_CENTER, - PARAM_DATA_STORE, - PARAM_DATA_STORE_AS_SERVICE, - PARAM_HOST_SYSTEMS, - PARAM_IGNORE_POWERED_OFF_VMS, - PARAM_IGNORE_VM_NAME_REGEX, - PARAM_MAKE_DEFAULT, - PARAM_MAP_NAMES, - PARAM_VCENTER, - PARAM_VM_NAMES, + Param, RULE_SET_NAME_VSPHERE_TOPO, TOPOLOGY_NAME, ) @@ -94,9 +84,9 @@ def check_vsphere_topo( ignored_powered_off_vms: int = 0 ignored_by_name_vms: int = 0 - name_map = get_name_map(params.get(PARAM_MAP_NAMES, [])) + name_map = get_name_map(params.get(Param.MAP_NAMES, [])) - if ignore_by_name_str := ')|('.join(params.get(PARAM_IGNORE_VM_NAME_REGEX, [])): + if ignore_by_name_str := ')|('.join(params.get(Param.IGNORE_VM_NAME_REGEX, [])): re_ignore_vms = re_compile(f'({ignore_by_name_str})') else: re_ignore_vms = None @@ -114,7 +104,7 @@ def check_vsphere_topo( objects.add_host( host=raw_vsphere_host, obj_id_prefix='vc', - icon=get_emblem(ICON_VCENTER, params.get(PARAM_VCENTER)), + icon=get_emblem(ICON_VCENTER, params.get(Param.VCENTER)), ) vsphere_host = f'vc{raw_vsphere_host}' @@ -124,21 +114,21 @@ def check_vsphere_topo( if objects.topo_objects.get(data_center) is None: objects.add_host( host=data_center, - emblem=get_emblem(EMBLEM_DATA_CENTER, params.get(PARAM_DATA_CENTER)), + emblem=get_emblem(Emblem.DATA_CENTER, params.get(Param.DATA_CENTER)), link2core=False, ) connections.add_connection(data_center, vsphere_host) cluster = name_map.get(raw_cluster, raw_cluster) objects.add_host( host=cluster, - emblem=get_emblem(EMBLEM_CLUSTER, params.get(PARAM_CLUSTER)), + emblem=get_emblem(Emblem.CLUSTER, params.get(Param.CLUSTER)), link2core=False ) connections.add_connection(cluster, data_center) host_systems: Sequence[str] = section_esx_vsphere_clusters[raw_cluster].get('hostsystems', '').split(',') for host_system in host_systems: - esx_name: str = adjust_name(host_system, params.get(PARAM_HOST_SYSTEMS, {})) + esx_name: str = adjust_name(host_system, params.get(Param.HOST_SYSTEMS, {})) esx_name = name_map.get(esx_name, esx_name) objects.add_host(host=esx_name) connections.add_connection(cluster, esx_name) @@ -183,11 +173,11 @@ def check_vsphere_topo( } ] for vm in section_esx_vsphere_virtual_machines: - if params.get(PARAM_IGNORE_POWERED_OFF_VMS) is not True or vm.get('powerstate') != 'poweredOff': - vm_name: str = adjust_name(vm['vm_name'], params.get(PARAM_VM_NAMES, {})) + if params.get(Param.IGNORE_POWERED_OFF_VMS) is not True or vm.get('powerstate') != 'poweredOff': + vm_name: str = adjust_name(str(vm['vm_name']), params.get(Param.VM_NAMES, {})) if re_ignore_vms is None or re_ignore_vms.match(vm_name) is None: vm_name = name_map.get(vm_name, vm_name) - host_system: str = adjust_name(vm['hostsystem'], params.get(PARAM_HOST_SYSTEMS, {})) + host_system: str = adjust_name(str(vm['hostsystem']), params.get(Param.HOST_SYSTEMS, {})) host_system = name_map.get(host_system, host_system) objects.add_host(host=vm_name) connections.add_connection(vm_name, host_system) @@ -205,17 +195,17 @@ def check_vsphere_topo( objects.add_host( host=data_stores_host, link2core=False, - emblem=get_emblem(EMBLEM_DATA_STORE, params.get(PARAM_DATA_STORE)), + emblem=get_emblem(Emblem.DATA_STORE, params.get(Param.DATA_STORE)), ) for ds_name in section_esx_vsphere_datastores: objects.add_host( host=ds_name, link2core=False, - emblem=get_emblem(EMBLEM_DATA_STORE, params.get(PARAM_DATA_STORE)), + emblem=get_emblem(Emblem.DATA_STORE, params.get(Param.DATA_STORE)), ) connections.add_connection(ds_name, data_stores_host) - if params.get(PARAM_DATA_STORE_AS_SERVICE) is True: + if params.get(Param.DATA_STORE_AS_SERVICE) is True: query: str = ( 'GET services\n' 'Columns: service_description\n' @@ -243,7 +233,7 @@ def check_vsphere_topo( ) if (vm_to_data_stores := ls_connection.query(query=query)) is not None: for vm, data_stores in vm_to_data_stores: - vm_name: str = adjust_name(vm, params.get(PARAM_VM_NAMES, {})) + vm_name: str = adjust_name(vm, params.get(Param.VM_NAMES, {})) vm_name = name_map.get(vm_name, vm_name) if vm_name in objects.topo_objects: data_stores = data_stores.split(',') @@ -272,11 +262,11 @@ def check_vsphere_topo( # workaround for backend is only picking up topologies from default folder add_dummy_topologies(sub_directory=raw_vsphere_host) # end workaround - make_topo_default(sub_directory=raw_vsphere_host, make_default=params.get(PARAM_MAKE_DEFAULT, False)) + make_topo_default(sub_directory=raw_vsphere_host, make_default=params.get(Param.MAKE_DEFAULT, False)) yield Result(state=State.OK, summary=f'Objects: {len(objects.topo_objects)}') yield Result(state=State.OK, summary=f'Connections: {len(connections.topo_connections)}') - if params.get(PARAM_IGNORE_POWERED_OFF_VMS) is True: + if params.get(Param.IGNORE_POWERED_OFF_VMS) is True: 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}') diff --git a/source/cmk_addons_plugins/vsphere_topo/constants.py b/source/cmk_addons_plugins/vsphere_topo/constants.py index e7b40d643c6235f9e4c21a3412255a65baa55f3b..9daa281ef11cff418d5337f352526223ef8c442c 100644 --- a/source/cmk_addons_plugins/vsphere_topo/constants.py +++ b/source/cmk_addons_plugins/vsphere_topo/constants.py @@ -8,41 +8,54 @@ # Date : 2024-07-16 # File : vsphere_topo/lib/ruelset_names.py +from enum import Enum, unique +from os import environ from typing import Final -EMBLEM_CLUSTER: Final[str] = 'icon_plugins_hw' -EMBLEM_DATA_CENTER: Final[str] = 'icon_cloud' -EMBLEM_DATA_STORE: Final[str] = 'icon_services_green' ICON_VCENTER: Final[str] = 'icon_topic_hosts' +RULE_SET_NAME_VSPHERE_TOPO: Final[str] = 'vsphere_topo' +TOPOLOGY_NAME: Final[str] ='vSphere' +OMD_ROOT = environ['OMD_ROOT'] +BASE_TOPO_PATH: Final[str] = f'{OMD_ROOT}/var/check_mk/topology/data' -# PARAM_ADD_DUMMY_TOPOLOGIES: Final[str] = 'add_dummy_topologies' -# PARAM_DONT_ADD_VC_AS_VM: Final[str] = 'dont_add_vc_as_vm' -PARAM_CHANGE_CASE: Final[str] = 'change_case' -PARAM_CLUSTER: Final[str] = 'cluster' -PARAM_CUSTOM_EMBLEM: Final[str] = 'custom_emblem' -PARAM_DATA_CENTER: Final[str] = 'data_center' -PARAM_DATA_STORE: Final[str] = 'data_store' -PARAM_DATA_STORE_AS_SERVICE: Final[str] = 'data_sore_as_service' -PARAM_DEFAULT_EMBLEM: Final[str] = 'default_emblem' -PARAM_HOST_SYSTEMS: Final[str] = 'host_systems' -PARAM_IGNORE_POWERED_OFF_VMS: Final[str] = 'ignore_powered_off_vms' -PARAM_IGNORE_VM_NAME_REGEX: Final[str] = 'ignore_vms_by_name' -PARAM_KEEP_DOMAIN: Final[str] = 'keep_domain' -PARAM_LOWER: Final[str] = 'lower' -PARAM_MAKE_DEFAULT: Final[str] = 'make_default' -PARAM_MAP_NAMES: Final[str] = 'map_names' -PARAM_MAP_NAME_CMK: Final[str] = 'name_cmk' -PARAM_MAP_NAME_VSPHERE: Final[str] = 'name_vsphere' -PARAM_NO_CHANGE: Final[str] = 'no_change' -PARAM_NO_EMBLEM: Final[str] = 'no_emblem' -PARAM_PREFIX: Final[str] = 'prefix' -PARAM_UPPER: Final[str] = 'upper' -PARAM_VCENTER: Final[str] = 'vcenter_icon' -PARAM_VM_NAMES: Final[str] = 'vm_names' +class EnumValue(Enum): + def __get__(self, instance, owner): + return self.value -PICTURE_TYPE_EMBLEM: Final[str] = 'emblem' -PICTURE_TYPE_ICON: Final[str] = 'icon' +@unique +class Emblem(EnumValue): + CLUSTER: Final[str] = 'icon_plugins_hw' + DATA_CENTER: Final[str] = 'icon_cloud' + DATA_STORE: Final[str] = 'icon_services_green' -RULE_SET_NAME_VSPHERE_TOPO: Final[str] = 'vsphere_topo' -TOPOLOGY_NAME: Final[str] ='vSphere' +@unique +class Param(EnumValue): + CHANGE_CASE: Final[str] = 'change_case' + CLUSTER: Final[str] = 'cluster' + CUSTOM_EMBLEM: Final[str] = 'custom_emblem' + DATA_CENTER: Final[str] = 'data_center' + DATA_STORE: Final[str] = 'data_store' + DATA_STORE_AS_SERVICE: Final[str] = 'data_sore_as_service' + DEFAULT_EMBLEM: Final[str] = 'default_emblem' + HOST_SYSTEMS: Final[str] = 'host_systems' + IGNORE_POWERED_OFF_VMS: Final[str] = 'ignore_powered_off_vms' + IGNORE_VM_NAME_REGEX: Final[str] = 'ignore_vms_by_name' + KEEP_DOMAIN: Final[str] = 'keep_domain' + LOWER: Final[str] = 'lower' + MAKE_DEFAULT: Final[str] = 'make_default' + MAP_NAMES: Final[str] = 'map_names' + MAP_NAME_CMK: Final[str] = 'name_cmk' + MAP_NAME_VSPHERE: Final[str] = 'name_vsphere' + NO_CHANGE: Final[str] = 'no_change' + NO_EMBLEM: Final[str] = 'no_emblem' + PREFIX: Final[str] = 'prefix' + SUFFIX: Final[str] = 'suffix' + UPPER: Final[str] = 'upper' + VCENTER: Final[str] = 'vcenter_icon' + VM_NAMES: Final[str] = 'vm_names' + +@unique +class Picture(EnumValue): + TYPE_EMBLEM: Final[str] = 'emblem' + TYPE_ICON: Final[str] = 'icon' diff --git a/source/cmk_addons_plugins/vsphere_topo/lib/utils.py b/source/cmk_addons_plugins/vsphere_topo/lib/utils.py index 9f4b36a307ba14a6e94d5189b41eb1a5c6dc9eda..7f11bed89ef68bca92937d48de4635bfa16da885 100644 --- a/source/cmk_addons_plugins/vsphere_topo/lib/utils.py +++ b/source/cmk_addons_plugins/vsphere_topo/lib/utils.py @@ -10,28 +10,17 @@ from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence from json import dumps as json_dunps, loads as json_loads -from os import environ from pathlib import Path from re import compile as re_compile -from typing import Final, Tuple +from typing import Tuple from livestatus import MultiSiteConnection, SiteConfigurations, SiteId from cmk_addons.plugins.vsphere_topo.constants import ( - PARAM_CHANGE_CASE, - PARAM_CUSTOM_EMBLEM, - PARAM_DEFAULT_EMBLEM, - PARAM_KEEP_DOMAIN, - PARAM_LOWER, - PARAM_MAP_NAME_CMK, - PARAM_MAP_NAME_VSPHERE, - PARAM_NO_CHANGE, - PARAM_NO_EMBLEM, - PARAM_PREFIX, - PARAM_UPPER, + BASE_TOPO_PATH, + OMD_ROOT, + Param, TOPOLOGY_NAME, ) -OMD_ROOT = environ['OMD_ROOT'] -BASE_TOPO_PATH: Final[str] = f'{OMD_ROOT}/var/check_mk/topology/data' def get_name_map(mappings: Sequence): @@ -39,49 +28,42 @@ def get_name_map(mappings: Sequence): name_map = {} for mapping in mappings: - if re_hostname.match(mapping[PARAM_MAP_NAME_CMK]) is not None: - name_map[mapping[PARAM_MAP_NAME_VSPHERE]] = mapping[PARAM_MAP_NAME_CMK] + if re_hostname.match(mapping[Param.MAP_NAME_CMK]) is not None: + name_map[mapping[Param.MAP_NAME_VSPHERE]] = mapping[Param.MAP_NAME_CMK] return name_map def adjust_name(name: str, params: Mapping[str, object]) -> str: - class Case: - upper: str = PARAM_UPPER - lower: str = PARAM_LOWER - no_change: str = PARAM_NO_CHANGE - - if params.get(PARAM_KEEP_DOMAIN) is None: + name = name.strip() + if params.get(Param.KEEP_DOMAIN) is None: name = name.split('.')[0] - match params.get(PARAM_CHANGE_CASE, PARAM_NO_CHANGE): - case Case.upper: + match params.get(Param.CHANGE_CASE, Param.NO_CHANGE): + case Param.UPPER: name = name.upper() - case Case.lower: + case Param.LOWER: name = name.lower() - case Case.no_change | _: # all else + case Param.NO_CHANGE | _: # all else pass - if (prefix := params.get(PARAM_PREFIX)) is not None: - name = f'{prefix.strip()}{name.strip()}' + if (prefix := params.get(Param.PREFIX)) is not None: + name = f'{str(prefix).strip()}{name}' + if (suffix := params.get(Param.SUFFIX)) is not None: + name = f'{name}{str(suffix).strip()}' return name.strip() def get_emblem(emblem: str, params: Tuple[str, bool | str] | None = None) -> str | None: - class Emblem: - no_emblem: str = PARAM_NO_EMBLEM - default_emblem: str = PARAM_DEFAULT_EMBLEM - custom_emblem: str = PARAM_CUSTOM_EMBLEM - match params: case None: return emblem - case (Emblem.no_emblem, True): + case (Param.NO_EMBLEM, True): return None - case (Emblem.default_emblem, True): + case (Param.DEFAULT_EMBLEM, True): return emblem - case _: # custom_emblem + case Param.CUSTOM_EMBLEM | _: return params[1].strip() diff --git a/source/cmk_addons_plugins/vsphere_topo/rulesets/vsphere_topo.py b/source/cmk_addons_plugins/vsphere_topo/rulesets/vsphere_topo.py index 95ff9b2ef000e4b2c706644275b05c7f36fcc853..4929399c1f5599e77be7dbb3b5dceef1bd0fea0f 100644 --- a/source/cmk_addons_plugins/vsphere_topo/rulesets/vsphere_topo.py +++ b/source/cmk_addons_plugins/vsphere_topo/rulesets/vsphere_topo.py @@ -28,82 +28,61 @@ from cmk.rulesets.v1.form_specs import ( from cmk.rulesets.v1.form_specs.validators import LengthInRange, MatchRegex from cmk.rulesets.v1.rule_specs import CheckParameters, HostCondition, Topic from cmk_addons.plugins.vsphere_topo.constants import ( - # PARAM_ADD_DUMMY_TOPOLOGIES, - # PARAM_DONT_ADD_VC_AS_VM, - EMBLEM_CLUSTER, - EMBLEM_DATA_CENTER, - EMBLEM_DATA_STORE, + Emblem, + Param, + Picture, ICON_VCENTER, - PARAM_CHANGE_CASE, - PARAM_CLUSTER, - PARAM_CUSTOM_EMBLEM, - PARAM_DATA_CENTER, - PARAM_DATA_STORE, - PARAM_DATA_STORE_AS_SERVICE, - PARAM_DEFAULT_EMBLEM, - PARAM_HOST_SYSTEMS, - PARAM_IGNORE_POWERED_OFF_VMS, - PARAM_IGNORE_VM_NAME_REGEX, - PARAM_KEEP_DOMAIN, - PARAM_LOWER, - PARAM_MAKE_DEFAULT, - PARAM_MAP_NAMES, - PARAM_MAP_NAME_CMK, - PARAM_MAP_NAME_VSPHERE, - PARAM_NO_CHANGE, - PARAM_NO_EMBLEM, - PARAM_PREFIX, - PARAM_UPPER, - PARAM_VCENTER, - PARAM_VM_NAMES, - PICTURE_TYPE_EMBLEM, - PICTURE_TYPE_ICON, RULE_SET_NAME_VSPHERE_TOPO, ) adjust_names_elements: Mapping[str, DictElement] = { - PARAM_KEEP_DOMAIN: DictElement( + Param.KEEP_DOMAIN: DictElement( parameter_form=FixedValue( title=Title('Keep domain name'), label=Label('The domain name will not be cut'), value=True, )), - PARAM_CHANGE_CASE: DictElement( + Param.CHANGE_CASE: DictElement( parameter_form=SingleChoice( title=Title('Change case'), elements=[ - SingleChoiceElement(name=PARAM_UPPER, title=Title('All upper case')), - SingleChoiceElement(name=PARAM_LOWER, title=Title('All lower case')), - SingleChoiceElement(name=PARAM_NO_CHANGE, title=Title('Don\'t change case')) + SingleChoiceElement(name=Param.UPPER, title=Title('All upper case')), + SingleChoiceElement(name=Param.LOWER, title=Title('All lower case')), + SingleChoiceElement(name=Param.NO_CHANGE, title=Title('Don\'t change case')) ], - prefill=DefaultValue(PARAM_NO_CHANGE) + prefill=DefaultValue(Param.NO_CHANGE) )), - PARAM_PREFIX: DictElement( + Param.PREFIX: DictElement( parameter_form=String( title=Title('Name prefix'), custom_validate=(LengthInRange(min_value=1),) )), + Param.SUFFIX: DictElement( + parameter_form=String( + title=Title('Name suffix'), + custom_validate=(LengthInRange(min_value=1),) + )), } def get_emblem_element(default_emblem: str, picture_type: str) -> Sequence[CascadingSingleChoiceElement]: return [ CascadingSingleChoiceElement( - name=PARAM_NO_EMBLEM, + name=Param.NO_EMBLEM, title=Title(f'No custom {picture_type}'), parameter_form=FixedValue( value=True, label=Label(f'No custom {picture_type} will be used') )), CascadingSingleChoiceElement( - name=PARAM_DEFAULT_EMBLEM, + name=Param.DEFAULT_EMBLEM, title=Title(f'Use default {picture_type}'), parameter_form=FixedValue( value=True, label=Label(f'"{default_emblem}" will be used as {picture_type}') )), CascadingSingleChoiceElement( - name=PARAM_CUSTOM_EMBLEM, + name=Param.CUSTOM_EMBLEM, title=Title(f'Use custom {picture_type}'), parameter_form=String( custom_validate=(LengthInRange(min_value=1),), @@ -115,57 +94,57 @@ def get_emblem_element(default_emblem: str, picture_type: str) -> Sequence[Casca def _parameter_form() -> Dictionary: return Dictionary( elements={ - PARAM_HOST_SYSTEMS: DictElement( + Param.HOST_SYSTEMS: DictElement( parameter_form=Dictionary( title=Title('Adjust ESXi host names'), elements=adjust_names_elements )), - PARAM_VM_NAMES: DictElement( + Param.VM_NAMES: DictElement( parameter_form=Dictionary( title=Title('Adjust VM names'), elements=adjust_names_elements )), - PARAM_VCENTER: DictElement( + Param.VCENTER: DictElement( parameter_form=CascadingSingleChoice( title=Title('vCenter Icon'), - elements=get_emblem_element(ICON_VCENTER, PICTURE_TYPE_ICON), - prefill=DefaultValue(PARAM_DEFAULT_EMBLEM), + elements=get_emblem_element(ICON_VCENTER, Picture.TYPE_ICON), + prefill=DefaultValue(Param.DEFAULT_EMBLEM), help_text=Help( 'Here you can change the icon for the vCenter object. If you use the built-in icons prefix ' 'the name with "icon_"' ), )), - PARAM_CLUSTER: DictElement( + Param.CLUSTER: DictElement( parameter_form=CascadingSingleChoice( title=Title('Cluster emblem'), - elements=get_emblem_element(EMBLEM_CLUSTER, PICTURE_TYPE_EMBLEM), - prefill=DefaultValue(PARAM_DEFAULT_EMBLEM), + elements=get_emblem_element(Emblem.CLUSTER, Picture.TYPE_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( title=Title('Datacenter emblem'), - elements=get_emblem_element(EMBLEM_DATA_CENTER, PICTURE_TYPE_EMBLEM), - prefill=DefaultValue(PARAM_DEFAULT_EMBLEM), + elements=get_emblem_element(Emblem.DATA_CENTER, Picture.TYPE_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( title=Title('Datastore emblem'), - elements=get_emblem_element(EMBLEM_DATA_STORE, PICTURE_TYPE_EMBLEM), - prefill=DefaultValue(PARAM_DEFAULT_EMBLEM), + elements=get_emblem_element(Emblem.DATA_STORE, Picture.TYPE_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( title=Title('Add data store service'), label=Label('enabled'), @@ -175,7 +154,7 @@ def _parameter_form() -> Dictionary: ), value=True )), - PARAM_MAKE_DEFAULT: DictElement( + Param.MAKE_DEFAULT: DictElement( parameter_form=FixedValue( title=Title('Make default'), label=Label('This will be the default topology'), @@ -185,7 +164,7 @@ def _parameter_form() -> Dictionary: ), value=True )), - PARAM_IGNORE_POWERED_OFF_VMS: DictElement( + Param.IGNORE_POWERED_OFF_VMS: DictElement( parameter_form=FixedValue( title=Title('Ignore powered off VMs'), label=Label('enabled'), @@ -194,7 +173,7 @@ def _parameter_form() -> Dictionary: ), value=True, )), - PARAM_IGNORE_VM_NAME_REGEX: DictElement( + Param.IGNORE_VM_NAME_REGEX: DictElement( parameter_form=List( title=Title('Ignore VMs by name (regex)'), element_template=String(), @@ -203,18 +182,18 @@ def _parameter_form() -> Dictionary: 'change to the VM names. If there more than one regex string the will be "OR" connected.' ), )), - PARAM_MAP_NAMES: DictElement( + Param.MAP_NAMES: DictElement( parameter_form=List( title=Title('Map vSphere names to CMK names'), element_template=Dictionary( elements={ - PARAM_MAP_NAME_VSPHERE: DictElement( + Param.MAP_NAME_VSPHERE: DictElement( parameter_form=String( title=Title('vSphere name'), ), required=True, ), - PARAM_MAP_NAME_CMK: DictElement( + Param.MAP_NAME_CMK: DictElement( parameter_form=String( title=Title('Checkmk name'), custom_validate=( @@ -232,28 +211,6 @@ def _parameter_form() -> Dictionary: ), help_text=Help(''), )), - # PARAM_DONT_ADD_VC_AS_VM: DictElement( - # render_only=True, - # parameter_form=FixedValue( - # title=Title('Don\'t add vCenter 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 - # )), - # PARAM_ADD_DUMMY_TOPOLOGIES: DictElement( - # render_only=True, - # parameter_form=FixedValue( - # title=Title('Add dummy topologies'), - # 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 - # )), } ) diff --git a/source/packages/vsphere_topo b/source/packages/vsphere_topo index 2800961788a22f7020767edcd6ddd815c0d06c85..2275e41cadd6e27029c124d6ef26e8b90bc76028 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.8-20240806', + 'version': '0.0.9-20250116', 'version.min_required': '2.3.0b1', 'version.packaged': 'cmk-mkp-tool 0.2.0', 'version.usable_until': '2.4.0b1'}