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

fixed crash on empty global data, added function to recreate missing local...

fixed crash on empty global data, added function to recreate missing local interface info for fortinet
parent 3da2e069
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/inv_lldp_cache-0.10.0-20240725.mkp "inv_lldp_cache-0.10.0-20240725.mkp"
[PACKAGE]: ../../raw/master/mkp/inv_lldp_cache-0.10.1-20241214.mkp "inv_lldp_cache-0.10.1-20241214.mkp"
# LLDP inventory plugin
Adds the LLDP information from network devices to the inventory
......
File added
......@@ -42,6 +42,8 @@
# 2024-07-24: made mac address validation more precise
# 2024-07-25: added support for Fortinet port aggregations -> see inline note
# added MAC address format aabbcc-ddeeff
# 2024-12-06: fixed crash on empty lldp global data
# 2024-12-14: recreate missing local interface info on fortinet switches
from collections.abc import Sequence
from dataclasses import dataclass
......@@ -360,7 +362,7 @@ def parse_inv_lldp_cache(string_table: List[StringByteTable]) -> Lldp | None:
neighbour_address=neighbour_address,
))
return Lldp(
lldp_global=LldpGlobal.parse(lldp_global[0]),
lldp_global=LldpGlobal.parse(lldp_global[0]) if lldp_global else None,
lldp_neighbours=neighbours
)
......@@ -521,6 +523,14 @@ def parse_inv_lldp_cache_fortinet(string_table: List[StringByteTable]) -> Lldp |
members = [port for port in members.split(' ') if port]
map_trunk2member[trunk_id.strip()] = members
if not if_info: # try to recreate missing if_info from if_name and trunk member
if_info = []
for index, name in if_name:
if name not in map_trunk2member:
if_info += [[index, '5', [ord(x) for x in name]]]
for ports in map_trunk2member.values():
if_info += [[map_if_name2idx[port], '5', [ord(x) for x in port]] for port in ports]
try:
interfaces = {
if_index: {'if_sub_type': if_sub_type, 'if_name': if_name}
......
......@@ -18,7 +18,7 @@
'web': ['plugins/views/inv_lldp_cache.py']},
'name': 'inv_lldp_cache',
'title': 'inventory for LLDP cache',
'version': '0.10.0-20240725',
'version': '0.10.1-20241214',
'version.min_required': '2.2.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