diff --git a/README.md b/README.md index ee58ae56030d3f7077c359293563ed8b0a67c670..24c8558bf6f9d3864dc0c15d3418a60231d8651a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[PACKAGE]: ../../raw/master/mkp/cisco_meraki-1.3.3-20240716.mkp "cisco_meraki-1.3.3-20240716.mkp" +[PACKAGE]: ../../raw/master/mkp/cisco_meraki-1.3.5-20240807.mkp "cisco_meraki-1.3.5-20240807.mkp" [SDK]: ../../raw/master/mkp/MerakiSDK-1.46.0-20240516.mkp "MerakiSDK-1.46.0-20240516.mkpp" # Cisco Meraki special agent diff --git a/mkp/cisco_meraki-1.3.5-20240807.mkp b/mkp/cisco_meraki-1.3.5-20240807.mkp new file mode 100644 index 0000000000000000000000000000000000000000..40da02f3c77b1f88c43d19f98c951ef190d4762f Binary files /dev/null and b/mkp/cisco_meraki-1.3.5-20240807.mkp differ diff --git a/source/cmk_addons_plugins/meraki/agent_based/appliance_performance.py b/source/cmk_addons_plugins/meraki/agent_based/appliance_performance.py index 5652ef1100af0b31c9cae760b483ac77e91d4ea0..5238b6dd5617dc85fa2b3cb939be4e2896bec6f7 100644 --- a/source/cmk_addons_plugins/meraki/agent_based/appliance_performance.py +++ b/source/cmk_addons_plugins/meraki/agent_based/appliance_performance.py @@ -10,6 +10,7 @@ # 2024-06-29: refactored for CMK 2.3 # 2024-06-30: renamed from cisco_meraki_org_appliance_performance.py in to appliance_performance.py +# 2024-08-02: fixed if perfscore was float instead of int from collections.abc import Mapping @@ -31,16 +32,15 @@ from cmk_addons.plugins.meraki.lib.utils import load_json # {"perfScore": 1} # sample string_table # [['[{"perfScore": 0}]']] - - -def parse_appliance_performance(string_table: StringTable) -> int | None: +# [['[{"perfScore": 12.0}]']] +# [['[{"perfScore": 0.00021434677238992957}]']] +def parse_appliance_performance(string_table: StringTable) -> float | None: json_data = load_json(string_table) - if (json_data := json_data[0]) is None: - return - perfscore = json_data.get('perfScore') - if isinstance(perfscore, int): - return int(perfscore) + try: + return float(json_data[0]['perfScore']) + except (ValueError, TypeError, KeyError): + return None agent_section_meraki_org_appliance_performance = AgentSection( @@ -49,11 +49,11 @@ agent_section_meraki_org_appliance_performance = AgentSection( ) -def discover_appliance_performance(section: int) -> DiscoveryResult: +def discover_appliance_performance(section: float) -> DiscoveryResult: yield Service() -def check_appliance_performance(params: Mapping[str, any], section: int) -> CheckResult: +def check_appliance_performance(params: Mapping[str, any], section: float) -> CheckResult: yield from check_levels( value=section, label='Utilization', diff --git a/source/cmk_addons_plugins/meraki/agent_based/wireless_device_ssid_status.py b/source/cmk_addons_plugins/meraki/agent_based/wireless_device_ssid_status.py index 0e4a30ca8765f263379c9990e1a2dd1c4a5976ef..04deeffde4b6350716691cf733cccb6de4d56d88 100644 --- a/source/cmk_addons_plugins/meraki/agent_based/wireless_device_ssid_status.py +++ b/source/cmk_addons_plugins/meraki/agent_based/wireless_device_ssid_status.py @@ -13,6 +13,7 @@ # moved data parsing in to SSID class # 2024-06-30: renamed from cisco_meraki_org_wireless_device_status.py int to wireless_device_ssid_status.py # 2024-07-13: fixed crash on missing metrics (device dormant) ThX to Leon Buhleier +# 2024-08-07: fixed crash on missing power value (unit only) ThX to Leon Buhleier from collections.abc import Mapping from dataclasses import dataclass @@ -126,7 +127,7 @@ def check_wireless_device_status( try: power = int(ssid.power.split(' ')[0]) - except AttributeError: + except (AttributeError, ValueError): power = None for metric, value in [ diff --git a/source/packages/cisco_meraki b/source/packages/cisco_meraki index dc6aecc4b8442630ed4580635d697c6c4d08fe62..7e179357dd4a88c1147ed1af223f83697b1708f0 100644 --- a/source/packages/cisco_meraki +++ b/source/packages/cisco_meraki @@ -63,7 +63,7 @@ 'web': ['plugins/views/cisco_meraki.py']}, 'name': 'cisco_meraki', 'title': 'Cisco Meraki special agent', - 'version': '1.3.3-20240716', + 'version': '1.3.5-20240807', 'version.min_required': '2.3.0b1', 'version.packaged': 'cmk-mkp-tool 0.2.0', 'version.usable_until': '2.4.0b1'}