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

added plugin version to long output

parent 8521e876
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -12,7 +12,7 @@
__AUTHOR__ = 'thl-cmk[at]outlook[dot]com'
__URL__ = 'https://thl-cmk.hopto.org/gitlab/checkmk/vendor-independent/bgp_topology'
__USAGE__ = '~/local/lib/python3/cmk_addons/plugins/bgp_topology/libexec/check_bgp_topology --make-default'
__USAGE__ = '~/local/lib/python3/cmk_addons/plugins/bgp_topology/libexec/check_bgp_topology --make-default --host bgp1'
__VERSION__ = '0.0.2-20241223'
from typing import Final
......
......@@ -11,6 +11,7 @@
# 2024-07-20: moved to lib -> is now an active check
# 2024-12-23: moved arg parser to lib/args.py
# fixed handling of anchors
# changed topology name to be always BGP_{host}
from collections.abc import MutableMapping, MutableSequence, Sequence
from dataclasses import dataclass
......@@ -18,6 +19,7 @@ from time import time_ns
from cmk.agent_based.v2 import render
from cmk_addons.plugins.bgp_topology.constants import (
__VERSION__,
BGP_PEER_LOCAL_ADDR,
BGP_PEER_LOCAL_AS,
BGP_PEER_LOCAL_ID,
......@@ -151,19 +153,17 @@ def create_bgp_topology(params: Params | None) -> int:
objects = TopoObjects()
connections = TopoConnections()
sub_directory = TOPOLOGY_NAME
sub_directory = f'{TOPOLOGY_NAME}_{params.host}'
ls_connection = LiveStatusConnection()
if params.include_sites is not None:
ls_connection.filter_sites(include=True, sites=params.include_sites)
sites_str: str = ', '.join(params.include_sites)
details.append(f'Site(s) included: {sites_str}')
sub_directory = f'{TOPOLOGY_NAME}_{params.host}'
elif params.exclude_sites is not None:
ls_connection.filter_sites(include=False, sites=params.exclude_sites)
sites_str: str = ', '.join(params.exclude_sites)
details.append(f'Site(s) excluded: {sites_str}')
sub_directory = f'{TOPOLOGY_NAME}_{params.host}'
bgp_anchor = get_anchor(params.bgp_anchor)
emblem_as = get_emblem(params.bgp_emblem_as)
......@@ -263,6 +263,8 @@ def create_bgp_topology(params: Params | None) -> int:
summary.append(f'Time taken: {render.timespan(value)}')
details.append(f'Time taken: {render.timespan(value)}')
details.append(f'Plugin version: {__VERSION__}')
perf_data = Metric(
name=METRIC_TIME_TAKEN,
value=value,
......
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