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

update project

parent 216f5561
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/inv_cdp_cache-0.7.1-20240320.mkp "inv_cdp_cache-0.7.1-20240320.mkp"
[PACKAGE]: ../../raw/master/mkp/inv_cdp_cache-0.7.2-20240405.mkp "inv_cdp_cache-0.7.2-20240405.mkp"
# CDP inventory plugin
Adds the CDP information from network devices to the inventory
......
File added
......@@ -26,7 +26,7 @@
# 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
#
# 2024-04-05: fixed missing global cdp data (Meraki)
from dataclasses import dataclass
from typing import List
......@@ -72,11 +72,11 @@ _interface_displayhints = {
@dataclass(frozen=True)
class CdpGlobal:
enabled: str
hold_time: int
last_change: str
local_id: str
message_interval: int
enabled: str | None
hold_time: int | None
last_change: str | None
local_id: str | None
message_interval: int | None
@dataclass(frozen=True)
......@@ -189,13 +189,18 @@ def parse_inv_cdp_cache(string_table: List[StringByteTable]) -> Cdp:
cdp_run, cdp_message_interval, cdp_hold_time, local_device_id, last_change = cdp_global[0]
_cdp_run = {
'0': 'no',
'1': 'yes',
}
global_info = CdpGlobal(
enabled='yes' if cdp_run == '1' else 'no',
message_interval=int(cdp_message_interval),
hold_time=int(cdp_hold_time),
local_id=str(local_device_id),
enabled=_cdp_run.get(cdp_run, None),
message_interval=int(cdp_message_interval) if cdp_message_interval.isdigit() else None,
hold_time=int(cdp_hold_time) if cdp_hold_time.isdigit() else None,
local_id=str(local_device_id) if local_device_id else None,
last_change=time.strftime(_TIME_FORMAT, time.localtime(
time.time() - (int(last_change) / 100))) if last_change.isdigit() else '',
time.time() - (int(last_change) / 100))) if last_change.isdigit() else None,
)
neighbours = []
......@@ -264,11 +269,11 @@ def inventory_cdp_cache(params, section: Cdp) -> InventoryResult:
yield Attributes(
path=path,
inventory_attributes={
'enabled': section.cdp_global.enabled,
'message_interval': section.cdp_global.message_interval,
'hold_time': section.cdp_global.hold_time,
'local_name': section.cdp_global.local_id,
'last_change': section.cdp_global.last_change
**({"enabled": section.cdp_global.enabled} if section.cdp_global.enabled else {}),
**({"message_interval": section.cdp_global.message_interval} if section.cdp_global.message_interval else {}),
**({"hold_time": section.cdp_global.hold_time} if section.cdp_global.hold_time else {}),
**({"local_name": section.cdp_global.local_id} if section.cdp_global.local_id else {}),
**({"last_change": section.cdp_global.last_change} if section.cdp_global.last_change else {}),
}
)
......
......@@ -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-20240320',
'version': '0.7.2-20240405',
'version.min_required': '2.2.0b1',
'version.packaged': '2.2.0p17',
'version.packaged': '2.2.0p24',
'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