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

update project

parent 15846282
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/inv_lldp_cache-0.9.5-20240407.mkp "inv_lldp_cache-0.9.5-20240407.mkp"
[PACKAGE]: ../../raw/master/mkp/inv_lldp_cache-0.9.6-20240408.mkp "inv_lldp_cache-0.9.6-20240408.mkp"
# LLDP inventory plugin
Adds the LLDP information from network devices to the inventory
......
File added
......@@ -33,6 +33,8 @@
# drop invalid MAC addresses (length != 6)
# 2024-04-07: fixed missing/empty lldp_global in snmp data (ThX bitwiz@forum.checkmk.com)
# improved validation if SNMP input data
# fix crash on empty neighbour_name
# 2024-04-08: stop (early) if interface table can not be created
from dataclasses import dataclass
from ipaddress import ip_address
......@@ -213,6 +215,14 @@ def parse_inv_lldp_cache(string_table: List[StringByteTable]) -> Lldp | None:
except ValueError:
return
try:
interfaces = {
if_index: {'if_sub_type': if_sub_type, 'if_name': if_name}
for if_index, if_sub_type, if_name in if_info
}
except ValueError:
return
try:
mgmt_addresses = [oid_end for oid_end, lldp_rem_man_addr_if_subtype in lldp_mgmt_addresses]
except ValueError:
......@@ -228,14 +238,6 @@ def parse_inv_lldp_cache(string_table: List[StringByteTable]) -> Lldp | None:
local_name=global_system_name,
)
try:
interfaces = {
if_index: {'if_sub_type': if_sub_type, 'if_name': if_name}
for if_index, if_sub_type, if_name in if_info
}
except ValueError:
return
neighbours = []
for entry in lldp_info:
try:
......@@ -244,12 +246,12 @@ def parse_inv_lldp_cache(string_table: List[StringByteTable]) -> Lldp | None:
except ValueError:
continue
# skip neighbours without chassis id
if not chassis_id:
continue
chassis_id = _render_chassis_id(chassis_id_sub_type, chassis_id)
# skip neighbours without chassis id/name
if not chassis_id and not neighbour_name:
continue
neighbour_address = ''
for mgmt_address in mgmt_addresses:
if mgmt_address.startswith(oid_end):
......@@ -330,7 +332,10 @@ def inventory_lldp_cache(params, section: Lldp) -> InventoryResult:
if params.get('domain_name', ''):
neighbour_name = neighbour_name.replace(params.get('domain_name', ''), '')
else:
neighbour_name = neighbour_name.split('.')[0]
try:
neighbour_name = neighbour_name.split('.')[0]
except AttributeError:
pass
neighbour_port = neighbour.neighbour_port
local_port = neighbour.local_port
......
......@@ -17,7 +17,7 @@
'web': ['plugins/views/inv_lldp_cache.py']},
'name': 'inv_lldp_cache',
'title': 'inventory for LLDP cache',
'version': '0.9.5-20240407',
'version': '0.9.6-20240408',
'version.min_required': '2.2.0b1',
'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