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

update project

parent 1cbc6b04
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
#!/usr/bin/env python3
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# License: GNU General Public License v2
......@@ -37,17 +37,6 @@ from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
)
class Neighbour(NamedTuple):
ap_name: str
ap_address: str
neighbour_name: str
neighbour_address: str
neighbour_interface: str
neighbour_platform: str
duplex: str
speed: str
def _render_ip_address(bytestring):
bytestring_clean = bytestring.replace('"', '').replace('|4|', '').replace('.', ' ').strip().split(' ')
try:
......@@ -63,7 +52,6 @@ _cdp_duplex = {
3: 'half duplex',
}
_cdp_speed = {
0: 'N/A',
1: 'none',
......@@ -73,7 +61,6 @@ _cdp_speed = {
5: 'auto',
}
_interface_displayhints = {
'ethernet': 'eth',
'fastethernet': 'Fa',
......@@ -104,9 +91,10 @@ def _get_short_if_name(ifname: str) -> str:
return ifname
def parse_cisco_wlc_ap_cdp_cache(string_table: StringTable): # -> List[Neighbour]:
neighbours=[]
for deviceindex, apname, apaddresstype, apaddress, neighname, neighaddresstype, neighaddress, neighinterface, platform, duplex, speed in string_table:
def parse_cisco_wlc_ap_cdp_cache(string_table: StringTable):
neighbours = []
for deviceindex, apname, apaddresstype, apaddress, neighname, neighaddresstype, neighaddress, neighinterface, \
platform, duplex, speed in string_table:
if int(apaddresstype) == 1:
apaddress = _render_ip_address(apaddress)
......@@ -128,16 +116,10 @@ def parse_cisco_wlc_ap_cdp_cache(string_table: StringTable): # -> List[Neighbour
def inventory_cisco_wlc_ap_cdp_cache(params, section) -> InventoryResult:
removecolumns = []
remove_domain = False
domain_name = ''
use_short_if_name = False
if params:
removecolumns = params.get('removecolumns', removecolumns)
remove_domain = params.get('remove_domain', remove_domain)
domain_name = params.get('domain_name', domain_name)
use_short_if_name = params.get('use_short_if_name', use_short_if_name)
removecolumns = params['removecolumns']
remove_domain = params['remove_domain']
domain_name = params['domain_name']
use_short_if_name = params['use_short_if_name']
path = ['networking', 'wlan', 'controller', 'ap_cdp_cache']
......@@ -170,29 +152,33 @@ register.snmp_section(
name='inv_cisco_wlc_ap_cdp_cache',
parse_function=parse_cisco_wlc_ap_cdp_cache,
fetch=
SNMPTree(
base='.1.3.6.1.4.1.9.9.623.1.3.1.1', # ISCO-LWAPP-CDP-MIB::clcCdpApCacheEntry
oids=[
'1', # clcCdpApCacheDeviceIndex (1)
'2', # clcCdpApCacheApName (2)
'3', # clcCdpApCacheApAddressType (3)
'4', # clcCdpApCacheApAddress (4)
'6', # clcCdpApCacheNeighName (6)
'7', # clcCdpApCacheNeighAddressType (7)
'8', # clcCdpApCacheNeighAddress (8)
'9', # clcCdpApCacheNeighInterface (9)
'12', # clcCdpApCachePlatform (12)
'15', # clcCdpApCacheDuplex (15)
'16', # clcCdpApCacheInterfaceSpeed (16)
]
),
SNMPTree(
base='.1.3.6.1.4.1.9.9.623.1.3.1.1', # CISCO-LWAPP-CDP-MIB::clcCdpApCacheEntry
oids=[
'1', # clcCdpApCacheDeviceIndex
'2', # clcCdpApCacheApName
'3', # clcCdpApCacheApAddressType
'4', # clcCdpApCacheApAddress
'6', # clcCdpApCacheNeighName
'7', # clcCdpApCacheNeighAddressType
'8', # clcCdpApCacheNeighAddress
'9', # clcCdpApCacheNeighInterface
'12', # clcCdpApCachePlatform
'15', # clcCdpApCacheDuplex
'16', # clcCdpApCacheInterfaceSpeed
]
),
detect=contains('.1.3.6.1.2.1.1.1.0', 'Cisco Controller'), # sysDescr
)
register.inventory_plugin(
name='inv_cisco_wlc_ap_cdp_cache',
inventory_function=inventory_cisco_wlc_ap_cdp_cache,
inventory_default_parameters={},
inventory_default_parameters={
'removecolumns': [],
'remove_domain': False,
'domain_name': '',
'use_short_if_name': False,
},
inventory_ruleset_name='inv_cisco_wlc_ap_cdp_cache',
)
No preview for this file type
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