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

update project

parent d38d7a6d
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/inv_cdp_cache-0.7.1-20231221.mkp "inv_cdp_cache-0.7.1-20231221.mkp"
[PACKAGE]: ../../raw/master/mkp/inv_cdp_cache-0.7.1-20240320.mkp "inv_cdp_cache-0.7.1-20240320.mkp"
# CDP inventory plugin
Adds the CDP information from network devices to the inventory
......
File added
......@@ -25,28 +25,31 @@
# 2023-06-14: moved wato file to check_parameters sub directory
# 2023-10-13: changed if_name to_if description, need long version for network topology
# 2023-12-21: streamlined LLDP and CDP inventory
# 2024-03-20: added host label nvdct/has_cdp_neighbours:yes if the device has at least one cdp neighbour
#
import re
import time
import binascii
from dataclasses import dataclass
from typing import List
import binascii
import re
import time
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
OIDEnd,
OIDBytes,
OIDEnd,
)
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
Attributes,
HostLabel,
SNMPTree,
TableRow,
Attributes,
exists,
register,
)
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
StringByteTable,
HostLabelGenerator,
InventoryResult,
StringByteTable,
)
_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%m'
......@@ -70,26 +73,26 @@ _interface_displayhints = {
@dataclass(frozen=True)
class CdpGlobal:
enabled: str
message_interval: int
hold_time: int
local_id: str
last_change: str
local_id: str
message_interval: int
@dataclass(frozen=True)
class CdpNeighbour:
address: str
platform_details: str
capabilities: str
duplex: str
last_change: str
local_port: str
native_vlan: str
neighbour_id: str
neighbour_port: str
local_port: str
platform: str
capabilities: str
vtp_mgmt_domain: str
native_vlan: str
duplex: str
platform_details: str
power_consumption: str
last_change: str
vtp_mgmt_domain: str
@dataclass(frozen=True)
......@@ -250,6 +253,11 @@ def parse_inv_cdp_cache(string_table: List[StringByteTable]) -> Cdp:
)
def host_label_inv_cdp_cache(section: Cdp) -> HostLabelGenerator:
if len(section.cdp_neighbours) > 0:
yield HostLabel(name="nvdct/has_cdp_neighbours", value="yes")
def inventory_cdp_cache(params, section: Cdp) -> InventoryResult:
path = ['networking', 'cdp_cache']
......@@ -312,6 +320,7 @@ def inventory_cdp_cache(params, section: Cdp) -> InventoryResult:
register.snmp_section(
name='inv_cdp_cache',
parse_function=parse_inv_cdp_cache,
host_label_function=host_label_inv_cdp_cache,
fetch=[
SNMPTree(
base='.1.3.6.1.4.1.9.9.23.1.2.1.1',
......
......@@ -15,7 +15,7 @@
'web': ['plugins/views/inv_cdp_cache.py']},
'name': 'inv_cdp_cache',
'title': 'Inventory for Cisco CDP Cache',
'version': '0.7.1-20231221',
'version': '0.7.1-20240320',
'version.min_required': '2.2.0b1',
'version.packaged': '2.2.0p17',
'version.usable_until': None}
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