diff --git a/README.md b/README.md index 61688c3921a04e1120ae8c5168e42b8aac6d24c5..3ec1de4043d2b083a5cfac3a7bea6e4d3ad686fb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[PACKAGE]: ../../raw/master/mkp/nvdct-0.9.2-20241117.mkp "nvdct-0.9.2-20241117.mkp" +[PACKAGE]: ../../raw/master/mkp/nvdct-0.9.3-20241209.mkp "nvdct-0.9.3-20241209.mkp" # Network Visualization Data Creation Tool (NVDCT) This script creates the topology data file needed for the [Checkmk Exchange Network visualization](https://exchange.checkmk.com/p/network-visualization) plugin.\ diff --git a/mkp/nvdct-0.9.3-20241209.mkp b/mkp/nvdct-0.9.3-20241209.mkp new file mode 100644 index 0000000000000000000000000000000000000000..c82af8de03fbd218625773a996edf038cb19ac0a Binary files /dev/null and b/mkp/nvdct-0.9.3-20241209.mkp differ diff --git a/source/bin/nvdct/lib/args.py b/source/bin/nvdct/lib/args.py index abd5472d8a45408a84eab7de829f74ab689338f2..d113171964dc8cc45782ce1d157bbb61dc518a1d 100755 --- a/source/bin/nvdct/lib/args.py +++ b/source/bin/nvdct/lib/args.py @@ -48,7 +48,7 @@ from lib.utils import ( HOME_URL, MIN_CDP_VERSION, MIN_LLDP_VERSION, - MIN_IPV4_ADDRESSES, + MIN_IP_ADDRESSES, NVDCT_VERSION, # SAMPLE_SEEDS, SCRIPT, @@ -71,7 +71,7 @@ def parse_arguments() -> arg_Namespace: 'The required inventory data can be created with my inventory plugins:\n' 'CDP: https://thl-cmk.hopto.org/gitlab/checkmk/vendor-independent/inventory/inv_cdp_cache\n' # noqa: E501 'LLDP: https://thl-cmk.hopto.org/gitlab/checkmk/vendor-independent/inventory/inv_lldp_cache\n' # noqa: E501 - 'L3v4: https://thl-cmk.hopto.org/gitlab/checkmk/vendor-independent/inventory/inv_ipv4_addresses\n' # noqa: E501 + 'L3v4: https://thl-cmk.hopto.org/gitlab/checkmk/vendor-independent/inventory/inv_ip_address\n' # noqa: E501 '\n' f'\nVersion: {NVDCT_VERSION} | Written by: thl-cmk\n' f'for more information see: {HOME_URL}' @@ -124,8 +124,10 @@ def parse_arguments() -> arg_Namespace: help=( f' - CDP : needs inv_cdp_cache package at least in version {MIN_CDP_VERSION}\n' f' - LLDP : needs inv_lldp_cache package at least in version {MIN_LLDP_VERSION}\n' - f' - L3v4 : needs inv_ipv4_addresses package at least in version {MIN_IPV4_ADDRESSES}\n' - f' adds, layer 3 topology fpr IPv4 ' + f' - L3v4 : needs inv_ip_address package at least in version {MIN_IP_ADDRESSES}\n' + f' adds, layer 3 topology fpr IPv4\n' + f' - STATIC (deprecated)\n' + f' - CUSTOM (deprecated)\n' ) ) parser.add_argument( diff --git a/source/bin/nvdct/lib/backends.py b/source/bin/nvdct/lib/backends.py index cec1bf37869d0ec00908f04a6bbf0e17765e3afc..611b7a6332f5aeed116bdbb4f87d5a1fd6e171f5 100755 --- a/source/bin/nvdct/lib/backends.py +++ b/source/bin/nvdct/lib/backends.py @@ -305,7 +305,8 @@ class HostCacheLiveStatus(HostCache): 'GET hosts\n' 'Columns: name\n' 'OutputFormat: python3\n' - f'Filter: label_names ~ {label}\n' + # f'Filter: label_names ~ {label}\n' + f'Filter: labels = {label}\n' ) data: Sequence[Sequence[str]] = self.get_raw_data(query=query) LOGGER.debug(f'{self.backend} routing capable hosts: {data}') @@ -578,12 +579,14 @@ class HostCacheRestApi(HostCache): def get_hosts_by_label(self, label: str) -> List[str] | None: LOGGER.debug(f'{self.backend} get_hosts_by_label {label}') - query = '{"op": "~", "left": "label_names", "right": "' + label + '"}' + # query = '{"op": "=", "left": "label_names", "right": "' + label + '"}' + query = '{"op": "=", "left": "labels", "right": "' + label + '"}' + resp = self.__session.get( url=f"{self.__api_url}/domain-types/host/collections/all", params={ "query": query, - "columns": ['name'], + "columns": ['name', 'labels'], }, ) if resp.status_code == 200: diff --git a/source/bin/nvdct/lib/utils.py b/source/bin/nvdct/lib/utils.py index 27af6e0a0bb84fb7048c629effbc2375ad917656..1857bce35e32bca12b32cdbcd778a634646b638f 100755 --- a/source/bin/nvdct/lib/utils.py +++ b/source/bin/nvdct/lib/utils.py @@ -23,7 +23,7 @@ from time import time as now_time from tomllib import loads as toml_loads, TOMLDecodeError from typing import List, Dict, TextIO -NVDCT_VERSION = '0.9.2-20241117' +NVDCT_VERSION = '0.9.3-20241209' @unique @@ -70,16 +70,16 @@ COLUMNS_CDP = 'neighbour_name,local_port,neighbour_port' COLUMNS_L3v4 = 'address,device,cidr,network,type' COLUMNS_LLDP = 'neighbour_name,local_port,neighbour_port' HOME_URL = 'https://thl-cmk.hopto.org/gitlab/checkmk/vendor-independent/nvdct' -HOST_LABEL_CDP = 'nvdct/has_cdp_neighbours' -HOST_LABEL_L3V4 = 'nvdct/routing_capable' -HOST_LABEL_LLDP = 'nvdct/has_lldp_neighbours' +HOST_LABEL_CDP = "'nvdct/has_cdp_neighbours' 'yes'" +HOST_LABEL_L3V4 = "'nvdct/l3v4_topology' 'router'" +HOST_LABEL_LLDP = "'nvdct/has_lldp_neighbours' 'yes'" LABEL_CDP = 'CDP' LABEL_L3v4 = 'LAYER3v4' LABEL_LLDP = 'LLDP' LOG_FILE = f'{OMD_ROOT}/var/log/nvdct.log' LOGGER = getLogger('root)') MIN_CDP_VERSION = '0.7.1-20240320' -MIN_IPV4_ADDRESSES = '0.0.3-20240320' +MIN_IP_ADDRESSES = '0.0.5-2024120' MIN_LLDP_VERSION = '0.9.3-20240320' PATH_CDP = 'networking,cdp_cache,neighbours' PATH_INTERFACES = 'networking,interfaces' diff --git a/source/bin/nvdct/nvdct.py b/source/bin/nvdct/nvdct.py index 81ae95783b5da7675a657b78b878e2386b827978..16254c3cf373818ccd19a779382cef9aadadd02b 100755 --- a/source/bin/nvdct/nvdct.py +++ b/source/bin/nvdct/nvdct.py @@ -131,6 +131,9 @@ # SEED_DEVICES -> L2_SEED_DEVICES # incompatible removed option -s, --seed-devices from CLI -> use TOML section L2_SEED_DEVICES instead # incompatible changed the option keep-domain to remove-domain -> don't mess with neighbor names by default +# 2024-12-08: incompatible: changed hostlabel for L3v4 topology to nvdct/l3v4_topology +# needs at least inv_ip_address inv_ip_address-0.0.5-20241209.mkp + # creating topology data json from inventory data # diff --git a/source/packages/nvdct b/source/packages/nvdct index b5f492c8bf5cda417cfb721c907d20284e547d02..73ff4a11a7b6a314b0e31712667391fb1921d100 100644 --- a/source/packages/nvdct +++ b/source/packages/nvdct @@ -54,7 +54,7 @@ 'htdocs/images/icons/location_80.png']}, 'name': 'nvdct', 'title': 'Network Visualization Data Creation Tool (NVDCT)', - 'version': '0.9.2-20241117', + 'version': '0.9.3-20241209', 'version.min_required': '2.3.0b1', 'version.packaged': 'cmk-mkp-tool 0.2.0', 'version.usable_until': '2.4.0p1'}