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 1d294131 authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

update project

parent 53c52104
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/cisco_meraki-1.2.8-20240201.mkp "cisco_meraki-1.2.8-20240201.mkp"
[PACKAGE]: ../../raw/master/mkp/cisco_meraki-1.2.9-20240202.mkp "cisco_meraki-1.2.9-20240202.mkp"
[SDK]: ../../raw/master/mkp/MerkaiSDK-1.39.0-202311-10.mkp "MerkaiSDK-1.39.0-202311-10.mkpp"
# Cisco Meraki special agent
......
File added
......@@ -146,16 +146,24 @@ def discover_appliance_uplinks(section: Appliance) -> DiscoveryResult:
yield Service(item=uplink)
_STATUS_MAP = {
"active": 0,
"ready": 0,
"not connected": 1,
"failed": 2,
}
def check_appliance_uplinks(item: str, params: Mapping[str, any], section: Appliance) -> CheckResult:
try:
uplink: ApplianceUplink = section.uplinks[item]
except KeyError:
return None
if uplink.status not in ['active']:
yield Result(state=State(params.get('status_not_active', 1)), summary=f'Status: {uplink.status}')
else:
yield Result(state=State.OK, summary=f'Status: {uplink.status}')
if params.get('status_map'):
_STATUS_MAP.update(params['status_map'])
yield Result(state=State(_STATUS_MAP.get(uplink.status, 3)), summary=f'Status: {uplink.status}')
yield Result(state=State.OK, summary=f'IP: {uplink.ip}')
yield Result(state=State.OK, summary=f'Public IP: {uplink.public_ip}')
yield Result(state=State.OK, notice=f'Network: {section.network_name}')
......
......@@ -49,11 +49,27 @@ class DeviceInfo:
def host_label_meraki_device_info(section: DeviceInfo) -> HostLabelGenerator:
yield HostLabel('meraki/org_id', section.organisation_id)
yield HostLabel('meraki/org_name', section.organisation_name)
yield HostLabel('meraki/net_id', section.network_id)
yield HostLabel('meraki/net_name', section.network_name)
yield HostLabel('cmk/vendor', 'meraki')
"""Host label function
Labels:
cmk/meraki:
This label is set to "yes" for all Meraki devices
cmk/meraki/device_type:
This label is set to the Meraki product type to which the device belongs, such as "switch" or "wireless".
cmk/meraki/net_id:
This label is set to the network id the Meraki device belongs to.
cmk/meraki/net_name:
This label is set to the network name the Meraki device belongs to.
cmk/meraki/org_id:
This label is set to the organisation id the Meraki device belongs to.
cmk/meraki/org_name:
This label is set to the organisation name the Meraki device belongs to.
"""
yield HostLabel("cmk/meraki", "yes")
yield HostLabel("cmk/meraki/device_type", section.product)
yield HostLabel("cmk/meraki/net_id", section.network_id)
yield HostLabel("cmk/meraki/net_name", section.network_name)
yield HostLabel("cmk/meraki/org_id", section.organisation_id)
yield HostLabel("cmk/meraki/org_name", section.organisation_name)
def parse_device_info(string_table: StringTable) -> DeviceInfo | None:
......
......@@ -26,11 +26,32 @@ def _parameter_valuespec_cisco_meraki_org_appliance_uplinks():
title=_('Cisco Meraki Appliance Uplinks'),
optional_keys=True,
elements=[
('status_not_active',
MonitoringState(
title=_('Monitoring state if uplink is not "active"'),
default_value=1,
)),
('status_map',
Dictionary(
title=_('Map uplink status to monitoring state'),
elements=[
("active",
MonitoringState(
title=_('Monitoring state for uplink state "active"'),
default_value=0,
)),
("ready",
MonitoringState(
title=_('Monitoring state for uplink state "ready"'),
default_value=1,
)),
("not connected",
MonitoringState(
title=_('Monitoring state for uplink state "not connected"'),
default_value=2,
)),
("failed",
MonitoringState(
title=_('Monitoring state for uplink state "failed"'),
default_value=2,
)),
]
))
],
)
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# License: GNU General Public License v2
#
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2024-02-02
# File : cisco_meraki_org_wireless_status.py (WATO)
from cmk.gui.i18n import _
from cmk.gui.plugins.wato.utils import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersNetworking,
)
from cmk.gui.valuespec import (
Dictionary,
TextInput,
MonitoringState,
)
def _parameter_valuespec_cisco_meraki_wireless_status():
return Dictionary(
title=_('Cisco Meraki Appliance Uplinks'),
optional_keys=True,
elements=[
('state_if_not_enabled',
MonitoringState(
title=_('Monitoring state if SSID is "not enabled"'),
default_value=1,
)),
],
)
rulespec_registry.register(
CheckParameterRulespecWithItem(
title=lambda: _('Cisco Meraki Wireless device'),
check_group_name='cisco_meraki_wireless_device_status',
group=RulespecGroupCheckParametersNetworking,
parameter_valuespec=_parameter_valuespec_cisco_meraki_wireless_status,
match_type='dict',
item_spec=lambda: TextInput(title=_('The SSID'), ),
)
)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# License: GNU General Public License v2
#
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2024-02-02
# File : cisco_meraki_switch_ports_statuses.py (WATO)
from cmk.gui.i18n import _
from cmk.gui.plugins.wato.utils import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersNetworking,
)
from cmk.gui.valuespec import (
Dictionary,
TextInput,
MonitoringState,
)
def _parameter_valuespec_cisco_meraki_switch_ports_statuses():
return Dictionary(
title=_('Cisco Meraki Appliance Uplinks'),
optional_keys=True,
elements=[
('state_disabled',
MonitoringState(
title=_('Monitoring state if port is "disabled"'),
default_value=0,
)),
('state_not_connected',
MonitoringState(
title=_('Monitoring state if port is "not connected"'),
default_value=0,
)),
('state_not_full_duplex',
MonitoringState(
title=_('Monitoring state if port is "not full duplex"'),
default_value=1,
)),
('state_speed_change',
MonitoringState(
title=_('Monitoring state if speed is changed'),
default_value=1,
)),
('state_admin_change',
MonitoringState(
title=_('Monitoring state if admin state is changed'),
default_value=1,
)),
('state_op_change',
MonitoringState(
title=_('Monitoring state if operational state is changed'),
default_value=1,
)),
],
)
rulespec_registry.register(
CheckParameterRulespecWithItem(
title=lambda: _('Cisco Meraki Switch Ports'),
check_group_name='cisco_meraki_switch_ports_statuses',
group=RulespecGroupCheckParametersNetworking,
parameter_valuespec=_parameter_valuespec_cisco_meraki_switch_ports_statuses,
match_type='dict',
item_spec=lambda: TextInput(title=_('The Port ID'), ),
)
)
......@@ -23,13 +23,15 @@
'wato/check_parameters/cisco_meraki_org_device_status.py',
'wato/check_parameters/cisco_meraki_org_licenses_overviewi.py',
'wato/check_parameters/cisco_meraki_organisations.py',
'wato/check_parameters/cisco_meraki_organisations_api.py'],
'wato/check_parameters/cisco_meraki_organisations_api.py',
'wato/check_parameters/cisco_meraki_org_wireless_device_status.py',
'wato/check_parameters/cisco_meraki_switch_ports_statuses.py'],
'lib': ['python3/cmk/special_agents/agent_cisco_meraki.py'],
'web': ['plugins/views/cisco_meraki.py',
'plugins/wato/agent_cisco_meraki.py']},
'name': 'cisco_meraki',
'title': 'Cisco Meraki special agent',
'version': '1.2.8-20240201',
'version': '1.2.9-20240202',
'version.min_required': '2.2.0b1',
'version.packaged': '2.2.0p17',
'version.usable_until': '2.3.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