diff --git a/agent_based/cisco_cellular_lte.py b/agent_based/cisco_cellular_lte.py index d4be481c7ef8404e046f20815a787ea8e884dfa1..f62f652914104fc518664f5ad074a82678d57bfa 100644 --- a/agent_based/cisco_cellular_lte.py +++ b/agent_based/cisco_cellular_lte.py @@ -6,16 +6,18 @@ # Author: thl-cmk[at]outlook[dot]com # URL : https://thl-cmk.hopto.org # Date : 2022-09-17 +# File : cisco_cellular_lte.py + # # Monitor status of Cisco cellular modems/connections/interfaces # # 2022-09-20: added WATO options # -# snmpwalk sample +# sample snmpwalk # # -# sample info +# sample string_table # # @@ -59,7 +61,6 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import ( get_rate, GetRateError, get_value_store, - IgnoreResultsError, ) @@ -197,7 +198,7 @@ def parse_cisco_cellular_lte(string_table: List[StringByteTable]) -> Optional[Di for radio_oid_end, current_rsrp, current_rsrq in radio_table: radios[radio_oid_end] = CiscoCellularRadio( lte_rsrp=int(current_rsrp), - lte_rsrq=int(current_rsrq) // 10, # See Cisco bug ID CSCvt55347 + lte_rsrq=int(current_rsrq) # // 10, # See Cisco bug ID CSCvt55347 ) for profile_oid_end, apn_type, apn in profile_table: @@ -262,7 +263,7 @@ def parse_cisco_cellular_lte(string_table: List[StringByteTable]) -> Optional[Di def discovery_cisco_cellular_lte(params, section: Dict[str, CiscoCellularInterface]) -> DiscoveryResult: for item, interface in section.items(): - if interface.profile is not None or params['not_configured']: + if not params['only_configured'] or interface.profile is not None: yield Service(item=item) ########################################################################### @@ -281,7 +282,7 @@ def check_cisco_cellular_lte(item, params, section: Dict[str, CiscoCellularInter return if interface.profile is None: - yield Result(state=State(params['no_profile_state']), summary='No GSM/LTE profile configured') + yield Result(state=State(params['no_profile_state']), summary='No GSM/LTE SIM card associated') return metric_prefix = 'cisco_cellular_' @@ -317,7 +318,8 @@ def check_cisco_cellular_lte(item, params, section: Dict[str, CiscoCellularInter for value, label, render_func, levels_lower, metric in [ (interface.radio.lte_rsrp, 'RSRP', lambda v: f'{v} dBm', params['rsrp_levels_lower'], 'rsrp'), - (interface.radio.lte_rsrq, 'RSRQ', lambda v: f'{v} dB', params['rsrp_levels_lower'], 'rsrq',), + (interface.radio.lte_rsrq if params['CSCvt55347_fixed'] else interface.radio.lte_rsrq // 10, # handle Cisco BugID CSCvt55347 + 'RSRQ', lambda v: f'{v} dB', params['rsrp_levels_lower'], 'rsrq',), (interface.modem.rssi, 'RSSI', lambda v: f'{v} dBm', params['rssi_levels_lower'], 'rssi'), ]: yield from check_levels( @@ -347,21 +349,9 @@ def check_cisco_cellular_lte(item, params, section: Dict[str, CiscoCellularInter ) if interface.ipv4_addr: - yield Result(state=State.OK, summary=f'IPv4 Addr: {interface.ipv4_addr}') + yield Result(state=State.OK, notice=f'IPv4 Address: {interface.ipv4_addr}') if interface.ipv6_addr: - yield Result(state=State.OK, summary=f'IPv6 Addr: {interface.ipv6_addr}') - - # if interface.profile.apn_type == interface.pdn_type: - # yield Result( - # state=State.OK, - # notice=f'Current APN type: {_cisco_wan_cell_ext_protocol_type.get(interface.pdn_type)}' - # ) - # else: - # yield Result( - # state=State.WARN, - # summary=f'Current APN type: {_cisco_wan_cell_ext_protocol_type.get(interface.pdn_type)} ' - # f'(expected: {_cisco_wan_cell_ext_protocol_type.get(interface.profile.apn_type)})' - # ) + yield Result(state=State.OK, notice=f'IPv6 Address: {interface.ipv6_addr}') yield Result(state=State.OK, notice=f'Networkcode: {interface.modem.network}') expected_band = params['expected_band'] @@ -375,11 +365,11 @@ def check_cisco_cellular_lte(item, params, section: Dict[str, CiscoCellularInter 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)}') yield Result(state=State.OK, notice=f'Provider Time: {interface.modem.current_system_time}') - - yield Result(state=State.OK, notice='\nInventory') yield Result(state=State.OK, notice=f'APN: {interface.profile.apn}') - yield Result(state=State.OK, notice=f'Configured APN type: {_cisco_wan_cell_ext_protocol_type.get(interface.pdn_type)}') - yield Result(state=State.OK, notice=f'Current APN type: {_cisco_wan_cell_ext_protocol_type.get(interface.profile.apn_type)}') + yield Result( + state=State.OK, + notice=f'APN type: {_cisco_wan_cell_ext_protocol_type.get(interface.pdn_type)}/' + f'{_cisco_wan_cell_ext_protocol_type.get(interface.pdn_type)} (configured/current)') ########################################################################### # @@ -453,7 +443,7 @@ register.check_plugin( discovery_function=discovery_cisco_cellular_lte, discovery_ruleset_name='discovery_cisco_cellular_lte', discovery_default_parameters={ - 'not_configured': False, + 'only_configured': True, }, check_function=check_cisco_cellular_lte, check_default_parameters={ @@ -466,7 +456,8 @@ register.check_plugin( 'modem_not_up_state': 2, 'modem_not_online_state': 2, 'expected_band': '12', - 'state_not_expected_band': 0, + 'state_not_expected_band': 1, + 'CSCvt55347_fixed': False, }, check_ruleset_name='cisco_cellular_lte', ) diff --git a/agent_based/inv_cisco_cellular_lte.py b/agent_based/inv_cisco_cellular_lte.py index bd00724ffd63281f79c3b8ec0435d2a83f4fc1aa..13232256fdd88ea3bf48320c8adb3ab538f418c4 100644 --- a/agent_based/inv_cisco_cellular_lte.py +++ b/agent_based/inv_cisco_cellular_lte.py @@ -6,7 +6,7 @@ # Author: thl-cmk[at]outlook[dot]com # URL : https://thl-cmk.hopto.org # Date : 2022-09-26 -# File : inv_cisco_cellular_lte +# File : inv_cisco_cellular_lte.py # # inventory of Cisco cellular interfaces (SIM cards) # @@ -32,7 +32,6 @@ from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import ( @dataclass class CiscoCellularProfile: - apn_type: str apn: str @@ -52,7 +51,6 @@ _cisco_gsm_service_type = { '12': 'LTE FDD', } - _cisco_gsm_band = { '1': 'unknown', '2': 'invalid', @@ -76,6 +74,262 @@ _cisco_wan_cell_ext_protocol_type = { '5': 'IPv4v6', } +# https://en.wikipedia.org/wiki/Mobile_country_code +_mobile_country_code = { + "202": ("Greece", "GR"), + "204": ("Netherlands (Kingdom of the Netherlands)", "NL"), + "206": ("Belgium", "BE"), + "208": ("France", "FR"), + "212": ("Monaco", "MC"), + "213": ("Andorra", "AD"), + "214": ("Spain", "ES"), + "216": ("Hungary", "HU"), + "218": ("Bosnia and Herzegovina", "BA"), + "219": ("Croatia", "HR"), + "220": ("Serbia", "RS"), + "221": ("Kosovo", "XK"), + "222": ("Italy", "IT"), + "226": ("Romania", "RO"), + "228": ("Switzerland", "CH"), + "230": ("Czech Republic", "CZ"), + "231": ("Slovakia", "SK"), + "232": ("Austria", "AT"), + # "234": ("Guernsey (United Kingdom)", "GG"), + # "234": ("Jersey (United Kingdom)", "JE"), + # "234": ("Isle of Man (United Kingdom)", "IM"), + "234": ("United Kingdom", "GB"), + "235": ("United Kingdom", "GB"), + "238": ("Denmark (Kingdom of Denmark)", "DK"), + "240": ("Sweden", "SE"), + "242": ("Norway", "NO"), + "244": ("Finland", "FI"), + "246": ("Lithuania", "LT"), + "247": ("Latvia", "LV"), + "248": ("Estonia", "EE"), + "250": ("Russian Federation", "RU"), + "255": ("Ukraine", "UA"), + "257": ("Belarus", "BY"), + "259": ("Moldova", "MD"), + "260": ("Poland", "PL"), + "262": ("Germany", "DE"), + "266": ("Gibraltar (United Kingdom)", "GI"), + "268": ("Portugal", "PT"), + "270": ("Luxembourg", "LU"), + "272": ("Ireland", "IE"), + "274": ("Iceland", "IS"), + "276": ("Albania", "AL"), + "278": ("Malta", "MT"), + "280": ("Cyprus", "CY"), + "282": ("Georgia", "GE"), + "283": ("Armenia", "AM"), + "284": ("Bulgaria", "BG"), + "286": ("Turkey", "TR"), + "288": ("Faroe Islands (Kingdom of Denmark)", "FO"), + "289": ("Abkhazia", "GE-AB"), + "290": ("Greenland (Kingdom of Denmark)", "GL"), + "292": ("San Marino", "SM"), + "293": ("Slovenia", "SI"), + "294": ("North Macedonia", "MK"), + "295": ("Liechtenstein", "LI"), + "297": ("Montenegro", "ME"), + "302": ("Canada", "CA"), + "308": ("Saint Pierre and Miquelon", "PM"), + # "310": ("Guam (United States of America)", "GU"), + # "310": ("Northern Mariana Islands (United States of America)", "MP"), + "310": ("United States of America", "US"), + # "311": ("Guam (United States of America)", "GU"), + "311": ("United States of America", "US"), + "312": ("United States of America", "US"), + "313": ("United States of America", "US"), + "314": ("United States of America", "US"), + "315": ("United States of America", "US"), + "316": ("United States of America", "US"), + "330": ("Puerto Rico (United States of America)", "PR"), + "332": ("United States Virgin Islands", "VI"), + "334": ("Mexico", "MX"), + "338": ("Jamaica", "JM"), + # "340": ("Guadeloupe (France)", "GP"), + # "340": ("Martinique (France)", "MQ"), + # "340": ("Saint Barthélemy (France)", "BL"), + "340": ("Saint Martin (France)", "MF"), + "342": ("Barbados", "BB"), + "344": ("Antigua and Barbuda", "AG"), + "346": ("Cayman Islands (United Kingdom)", "KY"), + "348": ("British Virgin Islands (United Kingdom)", "VG"), + "350": ("Bermuda", "BM"), + "352": ("Grenada", "GD"), + "354": ("Montserrat (United Kingdom)", "MS"), + "356": ("Saint Kitts and Nevis", "KN"), + "358": ("Saint Lucia", "LC"), + "360": ("Saint Vincent and the Grenadines", "VC"), + # "362": ("Bonaire, Sint Eustatius and Saba", "BQ"), + # "362": ("Curaçao", "CW"), + "362": ("Sint Maarten", "SX"), + "363": ("Aruba", "AW"), + "364": ("Bahamas", "BS"), + "365": ("Anguilla (United Kingdom)", "AI"), + "366": ("Dominica", "DM"), + "368": ("Cuba", "CU"), + "370": ("Dominican Republic", "DO"), + "372": ("Haiti", "HT"), + "374": ("Trinidad and Tobago", "TT"), + "376": ("Turks and Caicos Islands", "TC"), + "400": ("Azerbaijan", "AZ"), + "401": ("Kazakhstan", "KZ"), + "402": ("Bhutan", "BT"), + "404": ("India", "IN"), + "405": ("India", "IN"), + "406": ("India", "IN"), + "410": ("Pakistan", "PK"), + "412": ("Afghanistan", "AF"), + "413": ("Sri Lanka", "LK"), + "414": ("Myanmar", "MM"), + "415": ("Lebanon", "LB"), + "416": ("Jordan", "JO"), + "417": ("Syria", "SY"), + "418": ("Iraq", "IQ"), + "419": ("Kuwait", "KW"), + "420": ("Saudi Arabia", "SA"), + "421": ("Yemen", "YE"), + "422": ("Oman", "OM"), + "424": ("United Arab Emirates", "AE"), + # "425": ("Israel", "IL"), + "425": ("Israel/Palestine", "IL/PS"), + "426": ("Bahrain", "BH"), + "427": ("Qatar", "QA"), + "428": ("Mongolia", "MN"), + "429": ("Nepal", "NP"), + "430": ("United Arab Emirates (Abu Dhabi)", "AE"), + "431": ("United Arab Emirates (Dubai)", "AE"), + "432": ("Iran", "IR"), + "434": ("Uzbekistan", "UZ"), + "436": ("Tajikistan", "TJ"), + "437": ("Kyrgyzstan", "KG"), + "438": ("Turkmenistan", "TM"), + "440": ("Japan", "JP"), + "441": ("Japan", "JP"), + "450": ("Korea, South", "KR"), + "452": ("Vietnam", "VN"), + "454": ("Hong Kong (People’s Republic of China)", "HK"), + "455": ("Macau (People’s Republic of China)", "MO"), + "456": ("Cambodia", "KH"), + "457": ("Laos", "LA"), + "460": ("China", "CN"), + "461": ("China", "CN"), + "466": ("Taiwan", "TW"), + "467": ("Korea, North", "KP"), + "470": ("Bangladesh", "BD"), + "472": ("Maldives", "MV"), + "502": ("Malaysia", "MY"), + "505": ("Australia", "AU"), + # "505": ("Norfolk Island", "NF"), + "510": ("Indonesia", "ID"), + "514": ("East Timor", "TL"), + "515": ("Philippines", "PH"), + "520": ("Thailand", "TH"), + "525": ("Singapore", "SG"), + "528": ("Brunei", "BN"), + "530": ("New Zealand", "NZ"), + "536": ("Nauru", "NR"), + "537": ("Papua New Guinea", "PG"), + "539": ("Tonga", "TO"), + "540": ("Solomon Islands", "SB"), + "541": ("Vanuatu", "VU"), + "542": ("Fiji", "FJ"), + "543": ("Wallis and Futuna", "WF"), + "544": ("American Samoa (United States of America)", "AS"), + "545": ("Kiribati", "KI"), + "546": ("New Caledonia", "NC"), + "547": ("French Polynesia (France)", "PF"), + "548": ("Cook Islands (Pacific Ocean)", "CK"), + "549": ("Samoa", "WS"), + "550": ("Micronesia, Federated States of", "FM"), + "551": ("Marshall Islands", "MH"), + "552": ("Palau", "PW"), + "553": ("Tuvalu", "TV"), + "554": ("Tokelau", "TK"), + "555": ("Niue", "NU"), + "602": ("Egypt", "EG"), + "603": ("Algeria", "DZ"), + "604": ("Morocco", "MA"), + "605": ("Tunisia", "TN"), + "606": ("Libya", "LY"), + "607": ("Gambia", "GM"), + "608": ("Senegal", "SN"), + "609": ("Mauritania", "MR"), + "610": ("Mali", "ML"), + "611": ("Guinea", "GN"), + "612": ("Ivory Coast", "CI"), + "613": ("Burkina Faso", "BF"), + "614": ("Niger", "NE"), + "615": ("Togo", "TG"), + "616": ("Benin", "BJ"), + "617": ("Mauritius", "MU"), + "618": ("Liberia", "LR"), + "619": ("Sierra Leone", "SL"), + "620": ("Ghana", "GH"), + "621": ("Nigeria", "NG"), + "622": ("Chad", "TD"), + "623": ("Central African Republic", "CF"), + "624": ("Cameroon", "CM"), + "625": ("Cape Verde", "CV"), + "626": ("São Tomé and PrÃncipe", "ST"), + "627": ("Equatorial Guinea", "GQ"), + "628": ("Gabon", "GA"), + "629": ("Congo", "CG"), + "630": ("Democratic Republic of the Congo", "CD"), + "631": ("Angola", "AO"), + "632": ("Guinea-Bissau", "GW"), + "633": ("Seychelles", "SC"), + "634": ("Sudan", "SD"), + "635": ("Rwanda", "RW"), + "636": ("Ethiopia", "ET"), + "637": ("Somalia", "SO"), + "638": ("Djibouti", "DJ"), + "639": ("Kenya", "KE"), + "640": ("Tanzania", "TZ"), + "641": ("Uganda", "UG"), + "642": ("Burundi", "BI"), + "643": ("Mozambique", "MZ"), + "645": ("Zambia", "ZM"), + "646": ("Madagascar", "MG"), + "647": ("French Indian Ocean Territories (France)", "RE/YT"), + # "647": ("French Indian Ocean Territories (France)", "YT"), + "648": ("Zimbabwe", "ZW"), + "649": ("Namibia", "NA"), + "650": ("Malawi", "MW"), + "651": ("Lesotho", "LS"), + "652": ("Botswana", "BW"), + "653": ("Swaziland", "SZ"), + "654": ("Comoros", "KM"), + "655": ("South Africa", "ZA"), + "657": ("Eritrea", "ER"), + "658": ("Saint Helena, Ascension and Tristan da Cunha", "SH"), + "659": ("South Sudan", "SS"), + "702": ("Belize", "BZ"), + "704": ("Guatemala", "GT"), + "706": ("El Salvador", "SV"), + "708": ("Honduras", "HN"), + "710": ("Nicaragua", "NI"), + "712": ("Costa Rica", "CR"), + "714": ("Panama", "PA"), + "716": ("Peru", "PE"), + "722": ("Argentina", "AR"), + "724": ("Brazil", "BR"), + "730": ("Chile", "CL"), + "732": ("Colombia", "CO"), + "734": ("Venezuela", "VE"), + "736": ("Bolivia", "BO"), + "738": ("Guyana", "GY"), + "740": ("Ecuador", "EC"), + "742": ("French Guiana (France)", "GF"), + "744": ("Paraguay", "PY"), + "746": ("Suriname", "SR"), + "748": ("Uruguay", "UY"), + "750": ("Falkland Islands (United Kingdom)", "FK"), + "995": ("British Indian Ocean Territory (United Kingdom)", "IO"), +} + def parse_inv_cisco_cellular_lte(string_table: List[StringByteTable]): section = [] @@ -83,14 +337,16 @@ def parse_inv_cisco_cellular_lte(string_table: List[StringByteTable]): modem_table, profile_table = string_table - for profile_oid_end, apn_type, apn in profile_table: + for profile_oid_end, apn in profile_table: radio_index, profile_index = profile_oid_end.split('.') profiles[radio_index] = CiscoCellularProfile( apn=apn, - apn_type=apn_type ) - for oid_end, service_type, imsi, imei, iccid, msisdn, country, network, current_band in modem_table: + for oid_end, service_type, imsi, imei, iccid, msisdn, country, network, mcc, current_band in modem_table: + if not country and mcc: + country = _mobile_country_code.get(mcc, (None, None))[0] + entry = { 'key_columns': { 'iccid': iccid, @@ -103,8 +359,7 @@ def parse_inv_cisco_cellular_lte(string_table: List[StringByteTable]): 'network': network if network else None, 'current_band': _cisco_gsm_band.get(current_band, f'Unknown {current_band}'), 'apn': profiles[oid_end].apn if profiles.get(oid_end) else None, - 'apn_type': _cisco_wan_cell_ext_protocol_type.get(profiles[oid_end].apn_type) if profiles.get(oid_end) else None, - 'service_type': _cisco_gsm_service_type.get(str(service_type[0]*256 + service_type[1])) + 'service_type': _cisco_gsm_service_type.get(str(service_type[0] * 256 + service_type[1])) }, 'status_columns': { @@ -147,13 +402,13 @@ register.snmp_section( '3.1.1.4', # c3gMsisdn '3.2.1.8', # c3gGsmCountry '3.2.1.9', # c3gGsmNetwork + '3.2.1.10', # c3gGsmMcc '3.4.1.1.3', # c3gGsmCurrentBand ]), SNMPTree( base='.1.3.6.1.4.1.9.9.817.1.1.2.3.1', # CISCO-WAN-CELL-EXT-MIB::cwceLteProfileEntry oids=[ OIDEnd(), - '2', # cwceLteProfileType '5', # cwceLteProfileApn ])], detect=all_of( @@ -164,7 +419,6 @@ register.snmp_section( register.inventory_plugin( name='inv_cisco_cellular_lte', inventory_function=inventory_cisco_cellular_lte, - inventory_default_parameters={ - }, inventory_ruleset_name='inv_cisco_cellular_lte', + inventory_default_parameters={}, ) diff --git a/cisco_cellular_lte.mkp b/cisco_cellular_lte.mkp index 243b86fe520023343700c1550021e122636e3146..dd38d7eb17bf06563a878350a36dd4d4dd1d8f0c 100644 Binary files a/cisco_cellular_lte.mkp and b/cisco_cellular_lte.mkp differ diff --git a/web/plugins/metrics/cisco_cellular_lte.py b/web/plugins/metrics/cisco_cellular_lte.py index ebef8307f51a4aaa66134d0dc19fefda7d813a59..0164494e65efddd3512bb4fd7e2a4b4c46bd1c37 100644 --- a/web/plugins/metrics/cisco_cellular_lte.py +++ b/web/plugins/metrics/cisco_cellular_lte.py @@ -6,8 +6,9 @@ # 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 +# Cisco Cellular LTE metrics plugin # # from cmk.gui.i18n import _ @@ -18,7 +19,6 @@ from cmk.gui.plugins.metrics import ( perfometer_info ) - metric_info['cisco_cellular_rsrp'] = { 'title': _('RSRP'), 'unit': 'dbm', @@ -35,12 +35,6 @@ metric_info['cisco_cellular_rssi'] = { 'color': '42/a', } -###################################################################################################################### -# -# how to graph perdata for bgp peer -# -###################################################################################################################### - graph_info['cisco_cellular.rsrp'] = { 'title': _('Reference Signal Received Power'), 'metrics': [ @@ -67,26 +61,3 @@ graph_info['cisco_cellular.rssi'] = { ('cisco_cellular_rssi', 'area'), ], } - - -# perfometer_info.append(('stacked', [ -# { -# 'type': 'logarithmic', -# 'metric': 'bgp_peer_fsmestablishedtime', -# 'half_value': 2592000.0, # ome month -# 'exponent': 2, -# }, -# { -# 'type': 'logarithmic', -# 'metric': 'bgp_peer_acceptedprefixes', -# 'half_value': 500000.0, -# 'exponent': 2, -# } -# ])) -# -# perfometer_info.append({ -# 'type': 'logarithmic', -# 'metric': 'bgp_peer_fsmestablishedtime', -# 'half_value': 2592000.0, # ome month -# 'exponent': 2, -# }) \ No newline at end of file diff --git a/web/plugins/views/inv_cisco_cellular_lte.py b/web/plugins/views/inv_cisco_cellular_lte.py index 7554aaf86b232c6ff9774b682a5fc09cbf22e3cb..2d3604ae739648cbed3d1bb7f740cf81e2ef393a 100644 --- a/web/plugins/views/inv_cisco_cellular_lte.py +++ b/web/plugins/views/inv_cisco_cellular_lte.py @@ -6,7 +6,7 @@ # Author: thl-cmk[at]outlook[dot]com # URL : https://thl-cmk.hopto.org # Date : 2022-09-26 -# File : view/inv_cisco_cellular_lte +# File : view/inv_cisco_cellular_lte.py # from cmk.gui.i18n import _ @@ -24,8 +24,8 @@ inventory_displayhints.update({ 'iccid', 'imsi', 'network', + 'country', 'apn', - 'apn_type', 'service_type' ], 'view': 'invcellularlte_of_host', @@ -42,7 +42,6 @@ inventory_displayhints.update({ '.networking.cellular:*.network': {'title': _('Network'), }, '.networking.cellular:*.current_band': {'title': _('Current band'), }, '.networking.cellular:*.apn': {'short': _('APN'), 'title': _('Access Point Name (APN)')}, - '.networking.cellular:*.apn_type': {'title': _('APN type'), }, '.networking.cellular:*.service_type': {'title': _('Service type'), }, }) diff --git a/web/plugins/wato/cisco_cellular_lte.py b/web/plugins/wato/cisco_cellular_lte.py index a5c77851aa5b37f4780513a444c18db6da061551..66d86980f80b2ce59d64bdc096e0e378a4f62833 100644 --- a/web/plugins/wato/cisco_cellular_lte.py +++ b/web/plugins/wato/cisco_cellular_lte.py @@ -6,7 +6,7 @@ # Author: thl-cmk[at]outlook[dot]com # URL : https://thl-cmk.hopto.org # Date : 2022-09-20 -# File : wato/cisco_cellular_lte +# File : wato/cisco_cellular_lte.py # from cmk.gui.i18n import _ @@ -15,8 +15,6 @@ from cmk.gui.valuespec import ( TextAscii, MonitoringState, FixedValue, - ListOfStrings, - ListOf, Integer, Tuple, DropdownChoice, @@ -58,6 +56,32 @@ def _parameter_valuespec_cisco_cellular_lte(): 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 Band'), + ('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, + )), ('roaming_state', MonitoringState( title=_('Monitoring state if the device is roaming'), @@ -66,8 +90,8 @@ def _parameter_valuespec_cisco_cellular_lte(): )), ('no_profile_state', MonitoringState( - title=_('Monitoring state if no GSM/LTE profile configured'), - help=_('Monitoring state if no GSM/LTE profile is configured. Default is WARN.'), + 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', @@ -88,6 +112,14 @@ def _parameter_valuespec_cisco_cellular_lte(): 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=_('') + )), ], ) @@ -99,7 +131,7 @@ rulespec_registry.register( match_type='dict', parameter_valuespec=_parameter_valuespec_cisco_cellular_lte, title=lambda: _('Cisco cellular LTE'), - item_spec=lambda: TextAscii(title=_('Item'), ), + item_spec=lambda: TextAscii(title=_('Interface name'), ), )) @@ -107,11 +139,11 @@ def _valuespec_discovery_cisco_cellular_lte(): return Dictionary( title=_('Cisco cellular LTE'), elements=[ - ('not_configured', + ('only_configured', FixedValue( - True, - title=_('Discover not configured interfaces'), - help=_('If enabled the plugin will also discover cellular interfaces without a profile attached.'), + False, + title=_('Discover interfaces without associated SIM card'), + help=_('If enabled the plugin will discover cellular interfaces without a associated SIM card.'), totext=_('') )), ],