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

update project

parent a45607aa
No related branches found
No related tags found
No related merge requests found
2016-05-24: fix for empty capabilities
2017-07-03: fixed neighbour port id as MAC address (HPE)
2018-01-24: added local interface, removed 'useless' oid's
2018-09-04: changes for CMK 1.5.x (inv_tree --> inv_tree_list)
2019-03-04: changes for CMK 1.5.x --> if CMK1.5.x capability information is changed to string
2020-03-15: added support for CMK1.6x
2020-07-31: added short interface names, code cleanup
2001-03-18: removed disable option from WATO
\ No newline at end of file
2021-03-18: removed disable option from WATO
2021-03-17: rewrite for CMK 2.0
2001-03-18: removed disable option from WATO
2021-03-22: workaround for oid_end != x.ifIndex.y (for Cisco UCS FIs / lbarbier[at]arkane-studios[dot]com)
2021-03-22: added handling of lldpchassisidsubtype 5 -> network address ipv4/ipv6
2021-07-10: made use short interface names configurable via wato
2021-07-19: fix for default parameters
2021-07-25: fix local_port --> local_port_num
\ No newline at end of file
......@@ -21,9 +21,11 @@
# 2021-03-22: added handling of lldpchassisidsubtype 5 -> network address ipv4/ipv6
# 2021-07-10: made use short interface names configurable via wato
# 2021-07-19: fix for default parameters
# 2021-07-25: fix local_port --> local_port_num
import re
from typing import List
from typing import List, TypedDict
from dataclasses import dataclass
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
StringTable,
......@@ -41,6 +43,18 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import (
exists,
)
@dataclass
class Neighbour(TypedDict):
local_port_num: str
chassis_id: str
port_id: str
port_description: str
system_name: str
system_description: str
capabilities_map_supported: str
cache_capabilities: str
_interface_displayhints = {
'ethernet': 'eth',
'fastethernet': 'Fa',
......@@ -71,7 +85,7 @@ def _get_short_if_name(ifname: str) -> str:
return ifname
def parse_inv_lldp_cache(string_table: List[StringTable]) -> list:
def parse_inv_lldp_cache(string_table: List[StringTable]) -> List[Neighbour]:
lldp_chassisidsubtype = {
0: 'n/a',
1: 'chassiscomponent',
......@@ -200,7 +214,7 @@ def parse_inv_lldp_cache(string_table: List[StringTable]) -> list:
if (cleanport_id != lldpportid) or (cleanport_id == ''):
lldpportid = render_mac_address(lldpportid)
neighbour = {
neighbour = Neighbour({
'local_port_num': local_port,
'chassis_id': lldpchassisid,
'port_id': lldpportid,
......@@ -209,19 +223,19 @@ def parse_inv_lldp_cache(string_table: List[StringTable]) -> list:
'system_description': lldpsystemdescription,
'capabilities_map_supported': render_capabilities(ldpcapabilitiesmapsupported),
'cache_capabilities': render_capabilities(lldpcachecapabilities),
}
})
neighbours.append(neighbour)
return neighbours
def inventory_lldp_cache(params, section: list) -> InventoryResult:
def inventory_lldp_cache(params, section: List[Neighbour]) -> InventoryResult:
removecolumns = params.get('removecolumns', [])
remove_domain = params.get('remove_domain', False)
domain_name = params.get('domain_name', '')
use_short_if_name = params.get('use_short_if_name', False)
path= ['networking', 'lldp_cache']
for neighbour in section:
if remove_domain:
if not domain_name == '':
......@@ -233,7 +247,7 @@ def inventory_lldp_cache(params, section: list) -> InventoryResult:
if use_short_if_name:
neighbour['port_id'] = _get_short_if_name(neighbour['port_id'])
neighbour['local_port'] = _get_short_if_name(neighbour['local_port'])
neighbour['local_port_num'] = _get_short_if_name(neighbour['local_port_num'])
key_columns = {
# 'system_name': neighbour['system_name'],
......
No preview for this file type
......@@ -16,7 +16,7 @@
'name': 'inv_lldp_cache',
'num_files': 3,
'title': 'inventory for LLDP cache',
'version': '20210719.v05c',
'version': '20210725.v05c',
'version.min_required': '2.0.0',
'version.packaged': '2021.07.14',
'version.usable_until': None}
\ No newline at end of file
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