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