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

changed hostlabel for L3v4 topology to nvdct/l3v4_topology

parent dd1c8012
No related branches found
No related tags found
No related merge requests found
[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.\
......
File added
......@@ -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(
......
......@@ -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:
......
......@@ -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'
......
......@@ -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
#
......
......@@ -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'}
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