diff --git a/CHANGELOG b/CHANGELOG index 315d5dd205329c43db6b47c97d9dd109e57b9555..ca0721be3e756cba915928df8df5f09155c6bdb2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,3 +4,4 @@ METRICS: fixed range for RSRP and RSRQ, added range for RSSI, added scalars for all 2022-11-16: added band as metric on special request METRICS: added graph for current band +2023-02-20: moved from ~/local/share/check_mk/... to ~/local/lib/check_mk... diff --git a/agent_based/cisco_cellular_lte.py b/agent_based/cisco_cellular_lte.py index 238688efcf11bad2fd6206258e06e712be199a35..489989a49229e52437fac8f3a994f914dadd1fca 100644 --- a/agent_based/cisco_cellular_lte.py +++ b/agent_based/cisco_cellular_lte.py @@ -14,6 +14,7 @@ # 2022-09-20: added WATO options # 2022-11-10: added upper_levels to perfdata for scalars in metrics # 2022-11-16: added band as metric on special request +# 2023-02-20: moved gui files from ~/local/share/check_mk/... to ~/local/lib/check_mk... # # sample snmpwalk # @@ -37,7 +38,8 @@ # SNR -> Signal to Noise Ratio # # for Values https://usatcorp.com/faqs/understanding-lte-signal-strength-values/ -# +# overview of all the quality metrics +# https://help.venntelecom.com/support/solutions/articles/44001930601-how-to-interpret-ec-io-sinr-rssi-rscp-rsrp-rsrq-parameters-in-2g-3g-lte-routers import time from dataclasses import dataclass diff --git a/cisco_cellular_lte.mkp b/cisco_cellular_lte.mkp index 675e4ddf337ca8f78d2107bc55bf2a605177a619..63ce79a563dbe8c4d118c0ec9a9b4ea20d466688 100644 Binary files a/cisco_cellular_lte.mkp and b/cisco_cellular_lte.mkp differ diff --git a/gui/metrics/cisco_cellular_lte.py b/gui/metrics/cisco_cellular_lte.py new file mode 100644 index 0000000000000000000000000000000000000000..d469b919bdecb866a71dd95cfb9413781f70a07f --- /dev/null +++ b/gui/metrics/cisco_cellular_lte.py @@ -0,0 +1,113 @@ +#!/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 : 2022-09-26 +# File : metrics/cisco_cellular_lte.py +# +# Cisco Cellular LTE metrics plugin +# +# 2022-11-10: fixed range for RSRP and RSRQ +# added range for RSSI +# added scalars for all +# 2022-11-16: added graph for current band +# +from cmk.gui.i18n import _ + +from cmk.gui.plugins.metrics.utils import ( + metric_info, + graph_info, + perfometer_info, + check_metrics, +) +check_metrics['check_mk-cisco_cellular'] = { + 'cisco_cellular_rsrp': {'auto_graph': False}, + 'cisco_cellular_rsrq': {'auto_graph': False}, + 'cisco_cellular_rssi': {'auto_graph': False}, + 'cisco_cellular_band': {'auto_graph': False}, +} + +metric_info['cisco_cellular_rsrp'] = { + 'title': _('RSRP'), + 'unit': 'dbm', + 'color': '22/a', +} +metric_info['cisco_cellular_rsrq'] = { + 'title': _('RSRQ'), + 'unit': 'db', + 'color': '32/a', +} +metric_info['cisco_cellular_rssi'] = { + 'title': _('RSSI'), + 'unit': 'dbm', + # 'unit': 'count', + 'color': '42/a', +} + +metric_info['cisco_cellular_band'] = { + 'title': _('Band'), + 'unit': 'count', + 'color': '12/b', +} + +graph_info['cisco_cellular.rsrp'] = { + 'title': _('Reference Signal Received Power (only with LTE)'), + 'metrics': [ + ('cisco_cellular_rsrp', 'area'), + ], + 'scalars': [ + ('cisco_cellular_rsrp:crit,-1,*', 'Critical'), + ('cisco_cellular_rsrp:warn,-1,*', 'Warning'), + ], + 'range': ('cisco_cellular_rsrp:max,-', 1), +} + +graph_info['cisco_cellular.rsrq'] = { + 'title': _('Reference Signal Received Quality (only with LTE)'), + 'metrics': [ + ('cisco_cellular_rsrq', 'area'), + ], + 'scalars': [ + ('cisco_cellular_rsrq:crit,-1,*', 'Critical'), + ('cisco_cellular_rsrq:warn,-1,*', 'Critical'), + ], + 'range': ('cisco_cellular_rsrq:max,-', 1), +} + +graph_info['cisco_cellular.rssi'] = { + 'title': _('Received Signal Strength Indicator'), + 'metrics': [ + ('cisco_cellular_rssi', 'area'), + ], + 'scalars': [ + ('cisco_cellular_rssi:crit,-1,*', 'Critical'), + ('cisco_cellular_rsrq:warn,-1,*', 'Critical'), + ], + 'range': ('cisco_cellular_rssi:max,-', 1) +} + +graph_info['cisco_cellular.band'] = { + 'title': _('Band'), + 'metrics': [ + ('cisco_cellular_band', 'area'), + ], + 'scalars': [ + ('13#2196F3', 'LTE'), + ('12#558B2F', 'WCDMA-2100'), + ('11#689F38', 'WCDMA-1900'), + ('10#7CB342', 'WCDMA-850'), + ('9#8BC34A', 'WCDMA-800'), + ('8#2E7D32', 'GSM-1900'), + ('7#388E3C', 'GSM-1800'), + ('6#43A047', 'GSM-900'), + ('5#4CAF50', 'GSM-850'), + ('4#F9A825', 'none'), + ('3#FFA000', 'invalid'), + ('2#FFB300', 'unknown'), + ('1#00ACC1', 'UMTS'), + ], + 'range': (0, 15) +} diff --git a/gui/views/inv_cisco_cellular_lte.py b/gui/views/inv_cisco_cellular_lte.py new file mode 100644 index 0000000000000000000000000000000000000000..59063587f9dc16a8616841dba86d197e4b74c4f7 --- /dev/null +++ b/gui/views/inv_cisco_cellular_lte.py @@ -0,0 +1,51 @@ +#!/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 : 2022-09-26 +# File : view/inv_cisco_cellular_lte.py +# +# 2023-02-20: moved from ~/local/share/check_mk/... to ~/local/lib/check_mk... +# + +from cmk.gui.i18n import _ +from cmk.gui.plugins.views.utils import ( + inventory_displayhints, +) +from cmk.gui.plugins.views.inventory import declare_invtable_view + +inventory_displayhints.update({ + '.networking.cellular:': { + 'title': _('Cellular (LTE)'), + 'keyorder': [ + 'imei', + 'iccid', + 'imsi', + 'fsn', + 'network', + 'country', + 'apn', + 'service_type' + ], + 'view': 'invcellularlte_of_host', + }, + '.networking.cellular:*.iccid': {'short': _('ICC ID'), 'title': _('Integrated Circuit Card ID (ICC ID)')}, + '.networking.cellular:*.imei': {'short': _('IMEI'), 'title': _('International Mobile Equipment Identifier (IMEI)')}, + '.networking.cellular:*.imsi': {'short': _('IMSI'), + 'title': _('International Mobile Subscriber Identifier (IMSI)')}, + '.networking.cellular:*.msisdn': { + 'short': _('MSISDN'), + 'title': _('Mobile Subscriber Integrated Services Digital Network Number (MSISDN') + }, + '.networking.cellular:*.fsn': {'short': _('FSN'), 'title': _('Factory serial Number (FSN)')}, + '.networking.cellular:*.country': {'title': _('Country'), }, + '.networking.cellular:*.network': {'title': _('Network'), }, + '.networking.cellular:*.current_band': {'title': _('Current band'), }, + '.networking.cellular:*.apn': {'short': _('APN'), 'title': _('Access Point Name (APN)')}, + '.networking.cellular:*.service_type': {'title': _('Service type'), }, +}) + +declare_invtable_view('invcellularlte', '.networking.cellular:', _('Cellular (LTE)'), _('Cellular (LTE)')) diff --git a/gui/wato/cisco_cellular_lte.py b/gui/wato/cisco_cellular_lte.py new file mode 100644 index 0000000000000000000000000000000000000000..9f3c1b490277fbfe8defe7f916dfcd0746d119da --- /dev/null +++ b/gui/wato/cisco_cellular_lte.py @@ -0,0 +1,173 @@ +#!/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 : 2022-09-20 +# File : wato/cisco_cellular_lte.py +# +# 2023-02-20: moved from ~/local/share/check_mk/... to ~/local/lib/check_mk... +# + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + TextAscii, + MonitoringState, + FixedValue, + Integer, + Tuple, + DropdownChoice, +) + +from cmk.gui.plugins.wato.utils import ( + CheckParameterRulespecWithItem, + rulespec_registry, + RulespecGroupCheckParametersNetworking, + RulespecGroupCheckParametersDiscovery, + HostRulespec, +) + + +def _parameter_valuespec_cisco_cellular_lte(): + return Dictionary( + elements=[ + ('rsrp_levels_lower', + Tuple( + title=_('Lower levels for RSRP'), + help=_('Lower levels for RSRP (Reference Signal Received Power) in dBm'), + elements=[ + Integer(title=_('Warning below'), default_value=-103, unit=_('dBm')), + Integer(title=_('Critical below'), default_value=-112, unit=_('dBm')), + ])), + ('rsrq_levels_lower', + Tuple( + title=_('Lower levels for RSRQ'), + help=_('Lower levels for RSRQ (Reference Signal Received Quality) in dB'), + elements=[ + Integer(title=_('Warning below'), default_value=-9, unit=_('dB')), + Integer(title=_('Critical below'), default_value=-13, unit=_('dB')), + ])), + ('rssi_levels_lower', + Tuple( + title=_('Lower levels for RSSI'), + help=_('Lower levels for RSSI (Received Signal Strength Indicator) in dBm'), + elements=[ + Integer(title=_('Warning below'), default_value=-75, unit=_('dBm')), + Integer(title=_('Critical below'), default_value=-85, unit=_('dBm')), + ])), + ('expected_band', + DropdownChoice( + title=_('Expected Band'), + help=_('The expected cellular band.'), + default_value='12', + choices=[ + ('12', 'LTE'), + ('0', 'UMTS'), + ('11', 'WCDMA-2100'), + ('10', 'WCDMA-1900'), + ('9', 'WCDMA-850'), + ('8', 'WCDMA-800'), + ('7', 'GSM-1900'), + ('6', 'GSM-1800'), + ('5', 'GSM-900'), + ('4', 'GSM-850'), + ('3', 'none'), + ('2', 'invalid'), + ('1', 'unknown'), + ] + )), + ('state_not_expected_band', + MonitoringState( + title=_('Monitoring state if current band is not expected band '), + help=_('Monitoring state if the current band is not the expected band. Default is WARN.'), + default_value=1, + )), + ('band_as_metric', + FixedValue( + True, + title=_('Show the current band as graph'), + help=_( + 'This will output the current band as performance data. Then you get a graph where you can ' + 'follow the band changes of the monitored device. Scalars are used to create a kind of ' + 'legend for this graph' + ), + totext=_('') + )), + ('roaming_state', + MonitoringState( + title=_('Monitoring state if the device is roaming'), + help=_('Monitoring state if the device is roaming. Default is WARN.'), + default_value=1, + )), + ('no_profile_state', + MonitoringState( + title=_('Monitoring state if no SIM card associated'), + help=_('Monitoring state if no SIM card associated with the interface. Default is WARN.'), + default_value=1, + )), + ('connection_state', + MonitoringState( + title=_('Monitoring state if the device is not connected'), + help=_('Monitoring state if the device is not connected. Default is CRIT.'), + default_value=1, + )), + ('modem_not_up_state', + MonitoringState( + title=_('Monitoring state if the modem is not up'), + help=_('Monitoring state if the the modem is not up. Default is CRIT.'), + default_value=1, + )), + ('modem_not_online_state', + MonitoringState( + title=_('Monitoring state if the modem is not online'), + help=_('Monitoring state if the the modem is not online. Default is CRIT.'), + default_value=1, + )), + ('CSCvt55347_fixed', + FixedValue( + True, + title=_('The device is not affected by Cisco Bug ID CSCvt55347.'), + help=_('In the Cisco OS is a Bug that gives the wrong value for RSRQ. Enable this option if ' + 'your device is not affected by this bug..'), + totext=_('') + )), + ], + ) + + +rulespec_registry.register( + CheckParameterRulespecWithItem( + check_group_name='cisco_cellular_lte', + group=RulespecGroupCheckParametersNetworking, + match_type='dict', + parameter_valuespec=_parameter_valuespec_cisco_cellular_lte, + title=lambda: _('Cisco cellular LTE'), + item_spec=lambda: TextAscii(title=_('Interface name'), ), + )) + + +def _valuespec_discovery_cisco_cellular_lte(): + return Dictionary( + title=_('Cisco cellular LTE'), + elements=[ + ('only_configured', + FixedValue( + False, + title=_('Discover interfaces without associated SIM card'), + help=_('If enabled the plugin will discover cellular interfaces without a associated SIM card.'), + totext=_('') + )), + ], + ) + + +rulespec_registry.register( + HostRulespec( + group=RulespecGroupCheckParametersDiscovery, + match_type='dict', + name='discovery_cisco_cellular_lte', + valuespec=_valuespec_discovery_cisco_cellular_lte, + )) diff --git a/packages/cisco_cellular_lte b/packages/cisco_cellular_lte index 12aea5a79e68c47808dc5ee9c29dd96ea719e746..7c4dad60af0c426ecec93bbeb74760bd02fbc60b 100644 --- a/packages/cisco_cellular_lte +++ b/packages/cisco_cellular_lte @@ -5,13 +5,12 @@ 'files': {'agent_based': ['cisco_cellular_lte.py', 'inv_cisco_cellular_lte.py'], 'checkman': ['cisco_cellular_lte'], - 'web': ['plugins/wato/cisco_cellular_lte.py', - 'plugins/metrics/cisco_cellular_lte.py', - 'plugins/views/inv_cisco_cellular_lte.py']}, + 'gui': ['metrics/cisco_cellular_lte.py', + 'views/inv_cisco_cellular_lte.py', + 'wato/cisco_cellular_lte.py']}, 'name': 'cisco_cellular_lte', - 'num_files': 6, 'title': 'Cisco cellular LTE', - 'version': '20221116.v0.0.2', - 'version.min_required': '2.0.0', - 'version.packaged': '2021.09.20', + 'version': '20230220.v0.0.2a', + 'version.min_required': '2.1.0', + 'version.packaged': '2.1.0p21', 'version.usable_until': None} \ No newline at end of file