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

fixed missing lib/args.py in MKP package

parent 3b6e8550
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/bgp_topology-0.0.3-20240104.mkp "bgp_topology-0.0.3-20240104.mkp"
[PACKAGE]: ../../raw/master/mkp/bgp_topology-0.0.4-20240116.mkp "bgp_topology-0.0.4-20240116.mkp"
# BGP Topology
This plugin will create a Network Visualization Topology from the Peer relations of your _BGP peer services_ in Checkmk.
......
File added
......@@ -13,7 +13,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 --host bgp1'
__VERSION__ = '0.0.3-20250104'
__VERSION__ = '0.0.4-20250116'
from typing import Final
......
#!/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-12-23
# File : bgp_topology/lib/args.py
from argparse import ArgumentParser, Namespace, RawTextHelpFormatter
from collections.abc import Sequence
from cmk_addons.plugins.bgp_topology.constants import (
__AUTHOR__,
__URL__,
__USAGE__,
__VERSION__,
ARG_PARSER_ANCHOR,
ARG_PARSER_ANCHOR_AS,
ARG_PARSER_ANCHOR_BOTH,
ARG_PARSER_ANCHOR_ID,
ARG_PARSER_EMBLEM_AS,
ARG_PARSER_EMBLEM_ID,
ARG_PARSER_HOST,
ARG_PARSER_MAKE_DEFAULT,
ARG_PARSER_NONE,
ARG_PARSER_SITES_EXCLUDE,
ARG_PARSER_SITES_INCLUDE,
ARG_PARSER_DEBUG,
EMBLEM_BGP_AS,
EMBLEM_BGP_ID,
)
from cmk_addons.plugins.bgp_topology.lib.utils import (
OMD_ROOT,
)
class Params(Namespace):
bgp_anchor: str
make_default: bool = False
bgp_emblem_as: str = EMBLEM_BGP_AS
bgp_emblem_id: str = EMBLEM_BGP_ID
include_sites: Sequence[str] | None = None
exclude_sites: Sequence[str] | None = None
host: str = ''
debug: bool = False
def parse_arguments(argv: Sequence[str]) -> Params:
parser = ArgumentParser(
prog='bgp_topology',
formatter_class=RawTextHelpFormatter,
description=f"""Create BGP peer network topology for Checkmk""",
epilog=f"""
Example usage:
{__USAGE__}
Version: {__VERSION__} | Written by {__AUTHOR__}
for more information see: {__URL__}
"""
)
parser.add_argument(
ARG_PARSER_ANCHOR,
choices=[
ARG_PARSER_ANCHOR_BOTH,
ARG_PARSER_ANCHOR_AS,
ARG_PARSER_ANCHOR_ID,
ARG_PARSER_NONE,
],
default=ARG_PARSER_ANCHOR_BOTH,
help='Anchor for external BGP objects (default: %(default)s).',
)
parser.add_argument(
ARG_PARSER_EMBLEM_AS,
type=str,
default=EMBLEM_BGP_AS,
help='Emblem to use for BGP-AS objects (default: %(default)s).',
)
parser.add_argument(
ARG_PARSER_EMBLEM_ID,
type=str,
default=EMBLEM_BGP_ID,
help='Emblem to use for BGP-ID objects (default: %(default)s).',
)
parser.add_argument(
ARG_PARSER_MAKE_DEFAULT,
action='store_const', const=True,
default=False,
help='Make this topology the default (default: %(default)s).',
)
parser.add_argument(
ARG_PARSER_HOST,
required=True,
type=str,
help="""The name of the Checkmk host to which the plugin is attached. This is set
automatically by Checkmk. If a site filter is active, the host name is
appended to the subdirectory where the topology is stored (“BGP” becomes
“BGP_host_name”). This way we can have more than one BGP topology without
overwriting each other.""",
)
site_filter = parser.add_mutually_exclusive_group()
site_filter.add_argument(
ARG_PARSER_SITES_INCLUDE,
type=str,
nargs='+',
help=f"""List of Checkmk site names to include in the topology creation.
Can not used together with {ARG_PARSER_SITES_EXCLUDE}""",
)
site_filter.add_argument(
ARG_PARSER_SITES_EXCLUDE,
type=str,
nargs='+',
help=f"""List of Checkmk site names to exclude from the topology creation.
Can not used together with {ARG_PARSER_SITES_INCLUDE}""",
)
parser.add_argument(
ARG_PARSER_DEBUG,
action='store_const', const=True,
default=False,
help='enable debug output',
)
return parser.parse_args(argv)
......@@ -13,6 +13,7 @@
# fixed handling of anchors
# changed topology name to be always BGP_{host}
# 2025-01-04: changed output directory to host name only
# 2025-0116: fixed missing lib/args.py in MKP package
from collections.abc import MutableMapping, MutableSequence, Sequence
from dataclasses import dataclass
......
......@@ -29,10 +29,11 @@
'bgp_topology/libexec/check_bgp_topology',
'bgp_topology/rulesets/bgp_topology.py',
'bgp_topology/server_side_calls/bgp_topology.py',
'bgp_topology/graphing/bgp_topology.py']},
'bgp_topology/graphing/bgp_topology.py',
'bgp_topology/lib/args.py']},
'name': 'bgp_topology',
'title': 'BGP peer topology',
'version': '0.0.3-20240104',
'version': '0.0.4-20240116',
'version.min_required': '2.3.0b1',
'version.packaged': 'cmk-mkp-tool 0.2.0',
'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