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

update project

parent 103687c7
Branches 1.6.x
No related tags found
No related merge requests found
......@@ -12,3 +12,4 @@
2021-07-17: added basic support for IOS-XE based WLAN controllers (C9800 family), without most of perfdata
fixed _render_mac_address/_render_ip_address, code cleanup, removed WIPS check
added lwap_uptime/time taken to join. changed perfdata to 1/s
2021-07-29: fix missing data from discovery (inv_ap_info)
......@@ -21,6 +21,7 @@
# 2021-07-17: added basic support for IOS-XE based WLAN controllers (C9800 family), without most of perfdata
# fixed _render_mac_address/_render_ip_address, code cleanup, removed WIPS check
# added lwap_uptime/time taken to join. changed perfdata to 1/s
# 2021-07-29: fix missing data from discovery (inv_ap_info)
#
from time import time
from dataclasses import dataclass
......@@ -165,11 +166,10 @@ _interface_displayhints = {
def _get_short_if_name(ifname: str) -> str:
"""
returns short interface name from long interface name
Return short interface name from long interface name.
ifname: is the long interface name
:type ifname: str
"""
for ifname_prefix in _interface_displayhints.keys():
if ifname.lower().startswith(ifname_prefix.lower()):
ifname_short = _interface_displayhints[ifname_prefix]
......@@ -329,17 +329,20 @@ def discovery_cisco_wlc(section: Dict[str, Ap]) -> DiscoveryResult:
def check_cisco_wlc(item, params, section: Dict[str, Ap]) -> CheckResult:
ap_missing_state = params.get('state_ap_missing', 1)
inv_ap_info = InvApInfo(
ap_location=params.get('inv_ap_info').get('ap_location'),
ap_model=params.get('inv_ap_info').get('ap_model'),
ap_serialnumber=params.get('inv_ap_info').get('ap_serialnumber'),
ap_ipaddress=params.get('inv_ap_info').get('ap_ipaddress'),
ap_ethernetmacaddress=params.get('inv_ap_info').get('ap_ethernetmacaddress'),
cdp_neigh_name=params.get('inv_ap_info').get('cdp_neigh_name', None),
cdp_neigh_address=params.get('inv_ap_info').get('cdp_neigh_address', None),
cdp_neigh_interface=params.get('inv_ap_info').get('cdp_neigh_interface', None),
cdp_neigh_platform=params.get('inv_ap_info').get('cdp_neigh_platform', None),
)
if params.get('inv_ap_info'):
inv_ap_info = InvApInfo(
ap_location=params.get('inv_ap_info').get('ap_location'),
ap_model=params.get('inv_ap_info').get('ap_model'),
ap_serialnumber=params.get('inv_ap_info').get('ap_serialnumber'),
ap_ipaddress=params.get('inv_ap_info').get('ap_ipaddress'),
ap_ethernetmacaddress=params.get('inv_ap_info').get('ap_ethernetmacaddress'),
cdp_neigh_name=params.get('inv_ap_info').get('cdp_neigh_name', None),
cdp_neigh_address=params.get('inv_ap_info').get('cdp_neigh_address', None),
cdp_neigh_interface=params.get('inv_ap_info').get('cdp_neigh_interface', None),
cdp_neigh_platform=params.get('inv_ap_info').get('cdp_neigh_platform', None),
)
else:
inv_ap_info = None
for ap_name, ap_alias in params.get('ap_list', []):
if item == ap_name:
......@@ -541,21 +544,24 @@ def check_cisco_wlc(item, params, section: Dict[str, Ap]) -> CheckResult:
yield Result(state=State(params.get('state_cdp_change', 1)), notice=' - CDP info missing', )
# ap has wrong serial number --> AP H/W changed.
if ap_info.ap_serialnumber != inv_ap_info.ap_serialnumber or \
ap_info.ap_model != inv_ap_info.ap_model or \
ap_info.ap_ethernetmacaddress != inv_ap_info.ap_ethernetmacaddress or \
ap_info.ap_ipaddress != inv_ap_info.ap_ipaddress or \
ap_info.ap_location != inv_ap_info.ap_location:
yield Result(
state=State(params.get('state_ap_change', 1)),
notice='Hardware changed',
details=f'\nAP hardware changed. Run inventory again. '
f'\n - Serial number (found/expected): {ap_info.ap_serialnumber} / {inv_ap_info.ap_serialnumber} '
f'\n - Model (found/expected): {ap_info.ap_model} / {inv_ap_info.ap_model} '
f'\n - MAC address (found/expected): {ap_info.ap_ethernetmacaddress} / {inv_ap_info.ap_ethernetmacaddress} '
f'\n - IP address (found/expected): {ap_info.ap_ipaddress} / {inv_ap_info.ap_ipaddress} '
f'\n - Location (found/expected): {ap_info.ap_location} / {inv_ap_info.ap_location}',
)
if inv_ap_info:
if ap_info.ap_serialnumber != inv_ap_info.ap_serialnumber or \
ap_info.ap_model != inv_ap_info.ap_model or \
ap_info.ap_ethernetmacaddress != inv_ap_info.ap_ethernetmacaddress or \
ap_info.ap_ipaddress != inv_ap_info.ap_ipaddress or \
ap_info.ap_location != inv_ap_info.ap_location:
yield Result(
state=State(params.get('state_ap_change', 1)),
notice='Hardware changed',
details=f'\nAP hardware changed. Run inventory again. '
f'\n - Serial number (found/expected): {ap_info.ap_serialnumber} / {inv_ap_info.ap_serialnumber} '
f'\n - Model (found/expected): {ap_info.ap_model} / {inv_ap_info.ap_model} '
f'\n - MAC address (found/expected): {ap_info.ap_ethernetmacaddress} / {inv_ap_info.ap_ethernetmacaddress} '
f'\n - IP address (found/expected): {ap_info.ap_ipaddress} / {inv_ap_info.ap_ipaddress} '
f'\n - Location (found/expected): {ap_info.ap_location} / {inv_ap_info.ap_location}',
)
else:
yield Result(state=State.WARN, summary='AP data from discovery missing.')
register.snmp_section(
......
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