diff --git a/README.md b/README.md index 9459c6f420ef2fb1fbcc77971977074f65648fb9..a7bcca21f5901265a7a14826c2af42133add7a36 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[PACKAGE]: ../../raw/master/mkp/cisco_meraki-1.3.0-20240623.mkp "cisco_meraki-1.3.0-20240623.mkp" +[PACKAGE]: ../../raw/master/mkp/cisco_meraki-1.3.1-20240624.mkp "cisco_meraki-1.3.1-20240624.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.1-20240624.mkp b/mkp/cisco_meraki-1.3.1-20240624.mkp new file mode 100644 index 0000000000000000000000000000000000000000..2b2cc3f29a5951d38529793f04b51936ab31a2c2 Binary files /dev/null and b/mkp/cisco_meraki-1.3.1-20240624.mkp differ diff --git a/source/agent_based/cisco_meraki_org_appliance_uplinks.py b/source/agent_based/cisco_meraki_org_appliance_uplinks.py index ba13a695ba1ce62af23528f08d752e03f6445bd0..5bfe043668641ede214c5c2394bd2636dcbf8d98 100644 --- a/source/agent_based/cisco_meraki_org_appliance_uplinks.py +++ b/source/agent_based/cisco_meraki_org_appliance_uplinks.py @@ -13,7 +13,8 @@ # made data parsing more robust # 2024-05-15: fixed typo in output of uplink.received (in -> In) (ThX to Rickard Eriksson) # moved parse function to the dataclasses -# 2025-05-19: reworked appliance uplinks usage +# 2024-05-19: reworked appliance uplinks usage +# 2024-04-24: fixed, we can have no traffic if uplinc is not connected from dataclasses import dataclass from datetime import datetime @@ -186,25 +187,26 @@ def check_appliance_uplinks(item: str, params: Mapping[str, any], section: Appli yield Result(state=State.OK, summary=f'Public IP: {uplink.public_ip}') yield Result(state=State.OK, notice=f'Network: {section.network_name}') - if uplink.received: # and params.get('show_traffic'): - value = uplink.received * 8 / _TIMESPAN # Bits / Timespan - yield from check_levels( - value=value, # Bits - label='In', - metric_name='if_in_bps', - render_func=lambda v: render.networkbandwidth(v/8), # Bytes - # notice_only=True, - ) - - if uplink.sent: # and params.get('show_traffic'): - value = uplink.sent * 8 / _TIMESPAN # Bits / Timespan - yield from check_levels( - value=value, # Bits - label='Out', - metric_name='if_out_bps', - render_func=lambda v: render.networkbandwidth(v/8), # Bytes - # notice_only=True, - ) + if uplink.status in ['active']: # we can only have traffic, if uplinc is connected + if uplink.received: # and params.get('show_traffic'): + value = uplink.received * 8 / _TIMESPAN # Bits / Timespan + yield from check_levels( + value=value, # Bits + label='In', + metric_name='if_in_bps', + render_func=lambda v: render.networkbandwidth(v/8), # Bytes + # notice_only=True, + ) + + if uplink.sent: # and params.get('show_traffic'): + value = uplink.sent * 8 / _TIMESPAN # Bits / Timespan + yield from check_levels( + value=value, # Bits + label='Out', + metric_name='if_out_bps', + render_func=lambda v: render.networkbandwidth(v/8), # Bytes + # notice_only=True, + ) # not needed, will show in device status (?) # yield from check_last_reported_ts(last_reported_ts=section.last_reported_at.timestamp()) diff --git a/source/agent_based/cisco_meraki_org_device_status.py b/source/agent_based/cisco_meraki_org_device_status.py index 7d18010e0cf5891ca2f5c0b25049a9604ba2031d..48ebb619e335144ad16e4f231c77d08df1a0a623 100644 --- a/source/agent_based/cisco_meraki_org_device_status.py +++ b/source/agent_based/cisco_meraki_org_device_status.py @@ -15,10 +15,12 @@ # # 2023-11-09: fixed crash if no powersupply in components # 2023-11-19: fixed crash in inventory if no powersupply in components +# 2024-06-24: fixed don't output empty model/serial for poer supply + +from collections.abc import Mapping, Sequence from dataclasses import dataclass from datetime import datetime -from collections.abc import Mapping, Sequence from cmk.base.plugins.agent_based.agent_based_api.v1 import ( register, @@ -30,8 +32,8 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import ( from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import ( CheckResult, DiscoveryResult, - StringTable, InventoryResult, + StringTable, ) from cmk.base.plugins.agent_based.utils.cisco_meraki import ( @@ -176,9 +178,10 @@ def check_device_status_ps(item: str, params: Mapping[str, any], section: Device state=State(params.get('state_not_powering', 1)), summary=f'Status: {power_supply.status}', ) - - yield Result(state=State.OK, summary=f'Model: {power_supply.model}') - yield Result(state=State.OK, summary=f'Serial: {power_supply.serial}') + if power_supply.model: + yield Result(state=State.OK, summary=f'Model: {power_supply.model}') + if power_supply.serial: + yield Result(state=State.OK, summary=f'Serial: {power_supply.serial}') if power_supply.poe: yield Result( state=State.OK, diff --git a/source/gui/metrics/cisco_meraki.py b/source/gui/metrics/cisco_meraki.py index 25fb10aa82756458ec379b2c27ed7d0a468d6dcb..75e896cba96487053d43dad8125dc19085a9fb18 100644 --- a/source/gui/metrics/cisco_meraki.py +++ b/source/gui/metrics/cisco_meraki.py @@ -9,6 +9,7 @@ # # 2023-11-12: added wireless device status (channel, channel width, signal power) # 2024-05-12: added switch port statuses and API return Codes +# 2024-06-24: fixed, wrong total dor SSID perfometer signal_power -> 30 from cmk.gui.i18n import _ @@ -146,7 +147,7 @@ graph_info['cisco_meraki.wireless_device_status.channel'] = { perfometer_info.append({ 'type': 'linear', 'segments': ['signal_power'], - 'total': "signal_power", + 'total': 30, }) # @@ -328,4 +329,4 @@ perfometer_info.append({ # 'usage_in', # 'usage_out', # ] -# } \ No newline at end of file +# } diff --git a/source/packages/cisco_meraki b/source/packages/cisco_meraki index 5504fc1f72abc3baab380136a303b655b321a772..65c1dc0d4994771f6187842dd50191965fa5be30 100644 --- a/source/packages/cisco_meraki +++ b/source/packages/cisco_meraki @@ -60,7 +60,7 @@ 'plugins/wato/agent_cisco_meraki.py']}, 'name': 'cisco_meraki', 'title': 'Cisco Meraki special agent', - 'version': '1.3.0-20240623', + 'version': '1.3.1-20240624', 'version.min_required': '2.2.0b1', 'version.packaged': '2.2.0p27', 'version.usable_until': '2.3.0b1'} diff --git a/source/web/plugins/wato/agent_cisco_meraki.py b/source/web/plugins/wato/agent_cisco_meraki.py index a06ee7502940452ec4d9aaf83403d4f52f90fe59..60192b5e871594ed67fe8e131dc12300146f1f41 100644 --- a/source/web/plugins/wato/agent_cisco_meraki.py +++ b/source/web/plugins/wato/agent_cisco_meraki.py @@ -158,7 +158,7 @@ def _valuespec_special_agent_cisco_meraki() -> ValueSpec: (_SEC_NAME_SWITCH_PORTS_STATUSES, _SEC_TITLE_SWITCH_PORTS_STATUSES), (_SEC_NAME_WIRELESS_ETHERNET_STATUSES, - _SEC_TITLE_SWITCH_PORTS_STATUSES), + _SEC_TITLE_WIRELESS_ETHERNET_STATUSES), (_SEC_NAME_WIRELESS_DEVICE_STATUS, _SEC_TITLE_WIRELESS_DEVICE_STATUS), (_SEC_NAME_ORG_SWITCH_PORTS_STATUSES,