Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit 9cd74e71 authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

update project

parent 5a413e2f
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/cisco_meraki-1.3.5-20240807.mkp "cisco_meraki-1.3.5-20240807.mkp"
[PACKAGE]: ../../raw/master/mkp/cisco_meraki-1.3.6-20240915.mkp "cisco_meraki-1.3.6-20240915.mkp"
[SDK]: ../../raw/master/mkp/MerakiSDK-1.46.0-20240912.mkp "MerakiSDK-1.46.0-20240516.mkpp"
# Cisco Meraki special agent
......
File added
......@@ -14,6 +14,7 @@
# 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
# 2024-09-12: fixed missing SSID 0 ThX to Andreas Doehler
from collections.abc import Mapping
from dataclasses import dataclass
......@@ -71,7 +72,7 @@ def parse_wireless_device_status(string_table: StringTable) -> Mapping[str, SSID
if row.get('ssidName') and row.get('ssidName', '').startswith('Unconfigured SSID'):
continue # ignore unconfigured entry's
if not (ssid_number := row.get('ssidNumber')):
if (ssid_number := row.get('ssidNumber')) is None:
continue
item = str(ssid_number) + ' on band ' + row.get('band')
......
......@@ -37,6 +37,8 @@
# 2024-05-20: made appliance uplinks usage user selectable
# made API requests per org user selectable
# 2024-06-23: added cache time per section -> not nice but should work.
# 2024-09-12: added version check for min. Meraki SDK version
# 2024-09-15: fixed MerakiGetOrganizationSwitchPortsStatusesBySwitch -> return only list of switches
# ToDo: create inventory from Networks, is per organisation, not sure where/how to put this in the inventory
# ToDo: list Connected Datacenters like Umbrella https://developer.cisco.com/meraki/api-v1/list-data-centers/
......@@ -124,6 +126,8 @@ from cmk_addons.plugins.meraki.lib.utils import (
_SEC_CACHE_WIRELESS_ETHERNET_STATUSES,
)
_MERAKI_SDK_MIN_VERSION: Final = '1.46.0'
_LOGGER = getLogger("agent_cisco_meraki")
_API_NAME_API: Final = "api"
......@@ -644,11 +648,11 @@ class MerakiGetOrganizationSwitchPortsStatusesBySwitch(MerakiSectionOrg):
params=params,
timeout=3,
)
return response.json()
return response.json()['items']
# return self._config.dashboard.organizations.getOrganizationDevices(self._org_id, total_pages='all')
except RequestException as e:
_LOGGER.debug('Organisation ID: %r: Get Ports statuses by switch: %r', self._org_id, e)
return {}
return []
#
......@@ -1245,6 +1249,12 @@ def get_proxy(raw_proxy: str) -> str | None:
def agent_cisco_meraki_main(args: Args) -> int:
if meraki.__version__ < _MERAKI_SDK_MIN_VERSION:
print(
f'This Agent needs at least Meraki SDK version {_MERAKI_SDK_MIN_VERSION}, installed is {meraki.__version__}'
)
exit(1)
# don't remove used for runtime logging at the end
start_time = time_ns()
config = MerakiConfig(
......
......@@ -162,47 +162,46 @@ def _form_special_agent_cisco_meraki() -> Dictionary:
'sort the host in organisation specific folders.'
)
)),
"excluded_sections": DictElement(
parameter_form=MultipleChoice(
title=Title("Exclude Sections"),
elements=[
MultipleChoiceElement(name=_SEC_NAME_ORG_API_REQUESTS,
title=Title(_SEC_TITLE_ORG_API_REQUESTS)),
MultipleChoiceElement(name=_SEC_NAME_APPLIANCE_UPLINKS,
title=Title(_SEC_TITLE_APPLIANCE_UPLINKS)),
MultipleChoiceElement(name=_SEC_NAME_APPLIANCE_UPLINKS_USAGE,
title=Title(_SEC_TITLE_APPLIANCE_UPLINKS_USAGE)),
MultipleChoiceElement(name=_SEC_NAME_APPLIANCE_VPNS, title=Title(_SEC_TITLE_APPLIANCE_VPNS)),
MultipleChoiceElement(name=_SEC_NAME_APPLIANCE_PERFORMANCE,
title=Title(_SEC_TITLE_APPLIANCE_PERFORMANCE)),
MultipleChoiceElement(name=_SEC_NAME_CELLULAR_UPLINKS,
title=Title(_SEC_TITLE_CELLULAR_UPLINKS)),
MultipleChoiceElement(name=_SEC_NAME_DEVICE_STATUSES, title=Title(_SEC_TITLE_DEVICE_STATUSES)),
MultipleChoiceElement(name=_SEC_NAME_DEVICE_UPLINKS_INFO,
title=Title(_SEC_TITLE_DEVICE_UPLINKS_INFO)),
MultipleChoiceElement(name=_SEC_NAME_LICENSES_OVERVIEW,
title=Title(_SEC_TITLE_LICENSES_OVERVIEW)),
MultipleChoiceElement(name=_SEC_NAME_SENSOR_READINGS, title=Title(_SEC_TITLE_SENSOR_READINGS)),
MultipleChoiceElement(name=_SEC_NAME_SWITCH_PORTS_STATUSES,
title=Title(_SEC_TITLE_SWITCH_PORTS_STATUSES)),
MultipleChoiceElement(name=_SEC_NAME_WIRELESS_ETHERNET_STATUSES,
title=Title(_SEC_TITLE_WIRELESS_ETHERNET_STATUSES)),
MultipleChoiceElement(name=_SEC_NAME_WIRELESS_DEVICE_STATUS,
title=Title(_SEC_TITLE_WIRELESS_DEVICE_STATUS)),
MultipleChoiceElement(name=_SEC_NAME_ORG_SWITCH_PORTS_STATUSES,
title=Title(_SEC_TITLE_ORG_SWITCH_PORTS_STATUSES)),
],
prefill=DefaultValue([
_SEC_NAME_APPLIANCE_PERFORMANCE,
_SEC_NAME_SWITCH_PORTS_STATUSES,
_SEC_NAME_WIRELESS_DEVICE_STATUS,
_SEC_NAME_ORG_SWITCH_PORTS_STATUSES,
]),
# migrate=_migrate_to_valid_ident,
"excluded_sections": DictElement(
parameter_form=MultipleChoice(
title=Title("Exclude Sections"),
elements=[
MultipleChoiceElement(name=_SEC_NAME_ORG_API_REQUESTS,
title=Title(_SEC_TITLE_ORG_API_REQUESTS)),
MultipleChoiceElement(name=_SEC_NAME_APPLIANCE_UPLINKS,
title=Title(_SEC_TITLE_APPLIANCE_UPLINKS)),
MultipleChoiceElement(name=_SEC_NAME_APPLIANCE_UPLINKS_USAGE,
title=Title(_SEC_TITLE_APPLIANCE_UPLINKS_USAGE)),
MultipleChoiceElement(name=_SEC_NAME_APPLIANCE_VPNS, title=Title(_SEC_TITLE_APPLIANCE_VPNS)),
MultipleChoiceElement(name=_SEC_NAME_APPLIANCE_PERFORMANCE,
title=Title(_SEC_TITLE_APPLIANCE_PERFORMANCE)),
MultipleChoiceElement(name=_SEC_NAME_CELLULAR_UPLINKS,
title=Title(_SEC_TITLE_CELLULAR_UPLINKS)),
MultipleChoiceElement(name=_SEC_NAME_DEVICE_STATUSES, title=Title(_SEC_TITLE_DEVICE_STATUSES)),
MultipleChoiceElement(name=_SEC_NAME_DEVICE_UPLINKS_INFO,
title=Title(_SEC_TITLE_DEVICE_UPLINKS_INFO)),
MultipleChoiceElement(name=_SEC_NAME_LICENSES_OVERVIEW,
title=Title(_SEC_TITLE_LICENSES_OVERVIEW)),
MultipleChoiceElement(name=_SEC_NAME_SENSOR_READINGS, title=Title(_SEC_TITLE_SENSOR_READINGS)),
MultipleChoiceElement(name=_SEC_NAME_SWITCH_PORTS_STATUSES,
title=Title(_SEC_TITLE_SWITCH_PORTS_STATUSES)),
MultipleChoiceElement(name=_SEC_NAME_WIRELESS_ETHERNET_STATUSES,
title=Title(_SEC_TITLE_WIRELESS_ETHERNET_STATUSES)),
MultipleChoiceElement(name=_SEC_NAME_WIRELESS_DEVICE_STATUS,
title=Title(_SEC_TITLE_WIRELESS_DEVICE_STATUS)),
MultipleChoiceElement(name=_SEC_NAME_ORG_SWITCH_PORTS_STATUSES,
title=Title(_SEC_TITLE_ORG_SWITCH_PORTS_STATUSES)),
],
prefill=DefaultValue([
_SEC_NAME_APPLIANCE_PERFORMANCE,
_SEC_NAME_SWITCH_PORTS_STATUSES,
_SEC_NAME_WIRELESS_DEVICE_STATUS,
_SEC_NAME_ORG_SWITCH_PORTS_STATUSES,
]),
# migrate=_migrate_to_valid_ident,
),
required=True,
),
required=True,
),
"orgs": DictElement(
parameter_form=List(
element_template=String(macro_support=True), title=Title("Organizations"),
......@@ -261,6 +260,7 @@ def _form_special_agent_cisco_meraki() -> Dictionary:
render_only=True,
),
},
# prefill=DefaultValue('excluded_sections'),
)
......
......@@ -115,11 +115,11 @@ def agent_cisco_meraki_arguments(
args.append("--sections")
args += [s.replace("_", "-") for s in params.sections]
if params.excluded_sections is not None:
if params.excluded_sections:
args.append("--excluded-sections")
args += [s.replace("_", "-") for s in params.excluded_sections]
if params.orgs is not None:
if params.orgs:
args.append("--orgs")
args += [replace_macros(org, host_config.macros) for org in params.orgs]
......
......@@ -63,7 +63,7 @@
'web': ['plugins/views/cisco_meraki.py']},
'name': 'cisco_meraki',
'title': 'Cisco Meraki special agent',
'version': '1.3.5-20240807',
'version': '1.3.6-20240915',
'version.min_required': '2.3.0b1',
'version.packaged': 'cmk-mkp-tool 0.2.0',
'version.usable_until': '2.4.0b1'}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment