diff --git a/agent_based/cisco_wlc.py b/agent_based/cisco_wlc.py index 1f6e4437500e584016fa67f40ff900cc0c54af85..8c874173e70dd34ae9c10e73dd6d0daff997b26c 100644 --- a/agent_based/cisco_wlc.py +++ b/agent_based/cisco_wlc.py @@ -27,7 +27,7 @@ # 2022-05-31: removed "Software" from snmp detect function # 2022-10-23: fixed warning on upgrade "non-empty params vanished" for inv_ap_info # 2023-02-21: added cluster function (backport from check_mk) THX to roger[dot]ellenberger[at]wagner[dot]ch -# +# 2023-02-21: moved gui files from ~/local/share/check_mk/... to ~/local/lib/check_mk... from time import time from dataclasses import dataclass diff --git a/cisco_wlc.mkp b/cisco_wlc.mkp index c3e156e67d1e4b104ea4bcbca7ca977d9d4dd273..acb7a83641d485927e4ee10d4c8307aa70b920ad 100644 Binary files a/cisco_wlc.mkp and b/cisco_wlc.mkp differ diff --git a/gui/metrics/cisco_wlc.py b/gui/metrics/cisco_wlc.py new file mode 100644 index 0000000000000000000000000000000000000000..98bc0ca069d1e76786d78e0a8a973262c42c567d --- /dev/null +++ b/gui/metrics/cisco_wlc.py @@ -0,0 +1,176 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# License: GNU General Public License v2 +# +# Author: thl-cmk[at]outlook[dot]com +# URL : https://thl-cmk.hopto.org +# Date : 2018-01-06 +# +# +# missing a way to include hostname and service description +# +# 2023-02-21: moved from ~/local/share/check_mk/... to ~/local/lib/check_mk... +# + + +from cmk.gui.i18n import _ + +from cmk.gui.plugins.metrics.utils import ( + metric_info, + graph_info, + perfometer_info + +) + +##################################################################################################################### +# +# define metrics for perfdata +# +##################################################################################################################### + +metric_info['cisco_wlc_uptime_seconds'] = { + 'title': _('AP uptime'), + 'help': _(''), + 'unit': 's', + 'color': '26/a', +} + +metric_info['cisco_wlc_lwap_uptime_seconds'] = { + 'title': _('LWAP uptime'), + 'help': _(''), + 'unit': 's', + 'color': '41/a', +} + +metric_info['cisco_wlc_active_client_count'] = { + 'title': _('Active clients'), + 'help': _(''), + 'unit': 'count', + 'color': '11/a', +} + +metric_info['cisco_wlc_associated_clients'] = { + 'title': _('Associated clients'), + 'help': _(''), + 'unit': 'count', + 'color': '23/a', +} + +metric_info['cisco_wlc_reassoiation_success_count'] = { + 'title': _('Reassoiation success'), + 'help': _(''), + 'unit': '1/s', + 'color': '21/a', +} + +metric_info['cisco_wlc_reassoiation_failure_count'] = { + 'title': _('Reassoiation failure'), + 'help': _(''), + 'unit': '1/s', + 'color': '31/a', +} + +metric_info['cisco_wlc_reassoiation_failure_count_by_rate'] = { + 'title': _('Reassoiation failure rate'), + 'help': _(''), + 'unit': '1/s', + 'color': '41/a', +} + +metric_info['cisco_wlc_echo_request_count'] = { + 'title': _('Echo request'), + 'help': _(''), + 'unit': '1/s', + 'color': '12/a', +} + +metric_info['cisco_wlc_echo_response_loss_count'] = { + 'title': _('Echo response loss'), + 'help': _(''), + 'unit': '1/s', + 'color': '22/a', +} + +metric_info['cisco_wlc_association_fail_count_for_rssi_low'] = { + 'title': _('Association fail rssi low'), + 'help': _(''), + 'unit': '1/s', + 'color': '32/a', +} + +metric_info['cisco_wlc_association_fail_times'] = { + 'title': _('Association fail times'), + 'help': _(''), + 'unit': '1/s', + 'color': '42/a', +} + +metric_info['cisco_wlc_association_count'] = { + 'title': _('Associations'), + 'help': _(''), + 'unit': '1/s', + 'color': '13/a', +} + +###################################################################################################################### +# +# how to graph perdata +# +###################################################################################################################### + +graph_info['cisco_wlc.ap_uptime'] = { + 'title': _('AP/LWAP Uptime'), + 'metrics': [ + ('cisco_wlc_lwap_uptime_seconds', '-area'), + ('cisco_wlc_uptime_seconds', 'area'), + ], + 'optional_metrics': ['cisco_wlc_lwap_uptime_seconds'], +} + +graph_info['cisco_wlc.active_client'] = { + 'title': _('Active clients'), + 'metrics': [ + ('cisco_wlc_active_client_count', 'area'), + ('cisco_wlc_associated_clients', 'line'), + ], +} + +graph_info['cisco_wlc.counters'] = { + 'title': _('Counters'), + 'metrics': [ + ('cisco_wlc_reassoiation_success_count', 'line'), + ('cisco_wlc_reassoiation_failure_count', 'line'), + ('cisco_wlc_association_fail_times', 'line'), + ('cisco_wlc_association_fail_count_for_rssi_low', 'line'), + ('cisco_wlc_association_count', 'line'), + ], +} + +graph_info['cisco_elc_echo'] = { + 'title': _('Echos'), + 'metrics': [ + ('cisco_wlc_echo_request_count', 'area'), + ('cisco_wlc_echo_response_loss_count', '-area'), + ], +} + +###################################################################################################################### +# +# define perf-o-meter +# +###################################################################################################################### + +perfometer_info.append(('stacked', [ + { + 'type': 'logarithmic', + 'metric': 'cisco_wlc_uptime_seconds', + 'half_value': 2592000.0, + 'exponent': 2, + }, + { + 'type': 'linear', + 'segments': ['cisco_wlc_active_client_count'], + 'total': 200, + } +])) diff --git a/gui/wato/cisco_wlc.py b/gui/wato/cisco_wlc.py new file mode 100644 index 0000000000000000000000000000000000000000..d97168f4f3d80d5bfc68482aea3b4f6b9e07722e --- /dev/null +++ b/gui/wato/cisco_wlc.py @@ -0,0 +1,157 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# License: GNU General Public License v2 +# +# Author: thl-cmk[at]outlook[dot]com +# URL : https://thl-cmk.hopto.org +# Date : +# +# 2023-02-21: moved from ~/local/share/check_mk/... to ~/local/lib/check_mk... +# + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + Tuple, + TextAscii, + ListOf, + MonitoringState, + TextUnicode, +) + +from cmk.gui.plugins.wato.utils import ( + CheckParameterRulespecWithItem, + rulespec_registry, + RulespecGroupCheckParametersNetworking, +) + + +def _parameter_valuespec_cisco_wlc(): + return Dictionary( + elements=[ + ('state_ap_missing', + MonitoringState( + title=_('State if AP is missing'), + help=_('Set the monitoring state if the access point is not in the SNMP data. Default is WARN.'), + default_value=1, + )), + ('state_ap_adminstatus', + MonitoringState( + title=_('State if AP is not admin enabled'), + help=_('Set the monitoring state if the access point is not in "admin enable". Default is WARN.'), + default_value=1, + )), + ('state_ap_operationstatus', + MonitoringState( + title=_('State if AP is not operational'), + help=_('Set the monitoring state if the access point is not in "operational" state. Default is WARN.'), + default_value=1, + )), + ('state_ap_telnetenable', + MonitoringState( + title=_('State if Telnet is enabled'), + help=_('Set the monitoring state if the access point has telnet access enabled. Default is CRIT.'), + default_value=2, + )), + ('state_ap_sshenable', + MonitoringState( + title=_('State if SSH is enabled'), + help=_('Set the monitoring state if the access point has SSH access enabled. Default is WARN.'), + default_value=1, + )), + ('stateap_encryptionenable', + MonitoringState( + title=_('State if encryption is not enabled'), + help=_('Set the monitoring state if the LEAP/CAPWAP tunnel encryption nor enabled. Default is WARN.'), + default_value=1, + )), + ('state_ap_dataencryptionstatus', + MonitoringState( + title=_('State if encryption is not active'), + help=_('Set the monitoring state if the LWAP/CAPWAP tunnel encryption enabled but not active. ' + 'Default is WARN.'), + default_value=1, + )), + ('state_ap_powerstatus', + MonitoringState( + title=_('State if AP is not on full power'), + help=_('Set the monitoring state if the access point not on full power. Default is CRIT.'), + default_value=2, + )), + ('state_cdp_duplex', + MonitoringState( + title=_('State if CDP "half duplex"'), + help=_('Set the monitoring state if the the CDP neighbour info for "duplex" is "half duplex". ' + 'Default is WARN.'), + default_value=1, + )), + ('state_cdp_change', + MonitoringState( + title=_('State if CDP info is changed/missing'), + help=_('Set the monitoring state if the CDP info from the access point has changed or is missing. ' + 'This happens if the AP was moved to a different switch/interface. The CDP info will be used ' + 'to help locating a missing access point. ' + 'Default is WARN.'), + default_value=1, + )), + ('state_ap_change', + MonitoringState( + title=_('State if H/W has changed'), + help=_('Set the monitoring state if the hard ware of the access point has changed. This information ' + 'will be used to help locate a missing access point ' + 'Default is WARN.'), + default_value=1, + )), + ('ap_list', + ListOf( + Tuple( + elements=[ + TextUnicode( + title=_('AP name'), + help=_('The configured value must match a AP item as reported by the monitored ' + 'device. For example: "AP1.4"'), + allow_empty=False, + size=40, + ), + TextUnicode( + title=_('AP Alias'), + help=_('You can configure an individual alias here for the access point matching ' + 'the text configured in the "AP item name" field. The alias will ' + 'be shown in the check info'), + allow_empty=False, + size=40, + ), + ], + orientation='horizontal', + ), + title=_('AP alias'), + add_label=_('Add name'))), + ('inv_ap_info', # added by plugin discovery function + Dictionary( + elements=[ + ('ap_location', TextUnicode()), + ('ap_model', TextUnicode()), + ('ap_serialnumber', TextUnicode()), + ('ap_ipaddress', TextUnicode()), + ('ap_ethernetmacaddress', TextUnicode()), + ('cdp_neigh_name', TextUnicode()), + ('cdp_neigh_address', TextUnicode()), + ('cdp_neigh_interface', TextUnicode()), + ('cdp_neigh_platform', TextUnicode()), + ], + )), + ], + hidden_keys=['inv_ap_info'], + ) + + +rulespec_registry.register( + CheckParameterRulespecWithItem( + check_group_name='cisco_wlc', + group=RulespecGroupCheckParametersNetworking, + match_type='dict', + parameter_valuespec=_parameter_valuespec_cisco_wlc, + title=lambda: _('Cisco WLC APs'), + item_spec=lambda: TextAscii(title=_('Cisco WLC AP name'), ), + )) diff --git a/packages/cisco_wlc b/packages/cisco_wlc index e2cb239f0cef5e82dc5a94d37e4dcc2bc3f049d8..3f9f3e6feaf0af97e59e33f0c2e360f67a7357c0 100644 --- a/packages/cisco_wlc +++ b/packages/cisco_wlc @@ -9,11 +9,10 @@ 'Perfdata: Clientcount, clientfail, uptime, ...\n', 'download_url': 'http://thl-cmk.hopto.org', 'files': {'agent_based': ['cisco_wlc.py'], - 'web': ['plugins/wato/cisco_wlc.py', - 'plugins/metrics/cisco_wlc.py']}, + 'gui': ['metrics/cisco_wlc.py', 'wato/cisco_wlc.py']}, 'name': 'cisco_wlc', 'title': 'monitor Cisco WLC APs', - 'version': '20230221.v0.7', - 'version.min_required': '2.0.0', + 'version': '20230221.v0.8', + 'version.min_required': '2.1.0', 'version.packaged': '2.1.0p21', 'version.usable_until': None} \ No newline at end of file