diff --git a/agent_based/cisco_cellular_lte.py b/agent_based/cisco_cellular_lte.py index a53be97a4567e77a7ca969863f90a12d5cf255c4..238688efcf11bad2fd6206258e06e712be199a35 100644 --- a/agent_based/cisco_cellular_lte.py +++ b/agent_based/cisco_cellular_lte.py @@ -13,6 +13,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 # # sample snmpwalk # @@ -63,6 +64,7 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import ( get_rate, GetRateError, get_value_store, + Metric, ) @@ -283,7 +285,6 @@ def discovery_cisco_cellular_lte(params, section: Dict[str, CiscoCellularInterfa def check_cisco_cellular_lte(item, params, section: Dict[str, CiscoCellularInterface]) -> Optional[CheckResult]: - try: interface = section[item] except KeyError: @@ -412,6 +413,11 @@ def check_cisco_cellular_lte(item, params, section: Dict[str, CiscoCellularInter state=State(params['state_not_expected_band']), summary=f'Band: {_cisco_gsm_band.get(interface.modem.band)} (expected: {_cisco_gsm_band.get(expected_band)})' ) + if params['band_as_metric']: + yield Metric( + name=f'{metric_prefix}band', + value=int(interface.modem.band) + 1, + ) yield Result(state=State.OK, notice=f'Channel: {interface.modem.channel}') yield Result(state=State.OK, notice=f'Service type: {_cisco_gsm_service_type.get(interface.modem.service_type)}') @@ -509,6 +515,7 @@ register.check_plugin( 'expected_band': '12', 'state_not_expected_band': 1, 'CSCvt55347_fixed': False, + 'band_as_metric': False }, check_ruleset_name='cisco_cellular_lte', ) diff --git a/cisco_cellular_lte.mkp b/cisco_cellular_lte.mkp index 4ba640e57dc1f03ba4d8165c9196cd9c6f93d6e2..7ead58b9570f28378c4d712f911b4f05cf5f71b8 100644 Binary files a/cisco_cellular_lte.mkp and b/cisco_cellular_lte.mkp differ diff --git a/packages/cisco_cellular_lte b/packages/cisco_cellular_lte index 86e04f18c4e58e2707f6d32d011303229475b337..12aea5a79e68c47808dc5ee9c29dd96ea719e746 100644 --- a/packages/cisco_cellular_lte +++ b/packages/cisco_cellular_lte @@ -11,7 +11,7 @@ 'name': 'cisco_cellular_lte', 'num_files': 6, 'title': 'Cisco cellular LTE', - 'version': '20221110.v0.0.1a', + 'version': '20221116.v0.0.2', 'version.min_required': '2.0.0', 'version.packaged': '2021.09.20', 'version.usable_until': None} \ No newline at end of file diff --git a/web/plugins/metrics/cisco_cellular_lte.py b/web/plugins/metrics/cisco_cellular_lte.py index 495c52e05f9ae1e51362f1ac4f5212ba6c5f873c..3c7e70081fb683b3615d59b6a1a1084c43ce1c8a 100644 --- a/web/plugins/metrics/cisco_cellular_lte.py +++ b/web/plugins/metrics/cisco_cellular_lte.py @@ -13,14 +13,22 @@ # 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 import ( metric_info, graph_info, - perfometer_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'), @@ -35,9 +43,16 @@ metric_info['cisco_cellular_rsrq'] = { 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'), 'metrics': [ @@ -73,3 +88,26 @@ graph_info['cisco_cellular.rssi'] = { ], '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/web/plugins/wato/cisco_cellular_lte.py b/web/plugins/wato/cisco_cellular_lte.py index 46a86f06b82594fae16b5420a154a2e80a3b2511..febe951db95287e1e0edd38838c9e27943f5d32f 100644 --- a/web/plugins/wato/cisco_cellular_lte.py +++ b/web/plugins/wato/cisco_cellular_lte.py @@ -83,6 +83,17 @@ def _parameter_valuespec_cisco_cellular_lte(): 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'),