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

update project

parent 8988bfa4
No related branches found
No related tags found
No related merge requests found
...@@ -14,15 +14,6 @@ ...@@ -14,15 +14,6 @@
# 2018-09-04 : changes for CMK 1.5.x (inv_tree --> inv_tree_list) # 2018-09-04 : changes for CMK 1.5.x (inv_tree --> inv_tree_list)
# 2021-07-11 : rewritten for CMK 2.0 # 2021-07-11 : rewritten for CMK 2.0
import re
import time
import binascii
from typing import List, NamedTuple
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
OIDEnd,
OIDBytes,
)
from cmk.base.plugins.agent_based.agent_based_api.v1 import ( from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register, register,
SNMPTree, SNMPTree,
...@@ -35,187 +26,187 @@ from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import ( ...@@ -35,187 +26,187 @@ from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
) )
_last_reboot_reason = { _last_reboot_reason = {
0: 'none', '0': 'none',
1: 'dot11gModeChange', '1': 'dot11gModeChange',
2: 'ipAddressSet', '2': 'ipAddressSet',
3: 'ipAddressReset', '3': 'ipAddressReset',
4: 'rebootFromController', '4': 'rebootFromController',
5: 'dhcpFallbackFail', '5': 'dhcpFallbackFail',
6: 'discoveryFail', '6': 'discoveryFail',
7: 'noJoinResponse', '7': 'noJoinResponse',
8: 'denyJoin', '8': 'denyJoin',
9: 'noConfigResponse', '9': 'noConfigResponse',
10: 'configController', '10': 'configController',
11: 'imageUpgradeSuccess', '11': 'imageUpgradeSuccess',
12: 'imageOpcodeInvalid', '12': 'imageOpcodeInvalid',
13: 'imageCheckSumInvalid', '13': 'imageCheckSumInvalid',
14: 'imageDataTimeout', '14': 'imageDataTimeout',
15: 'configFileInvalid', '15': 'configFileInvalid',
16: 'imageDownloadError', '16': 'imageDownloadError',
17: 'rebootFromConsole', '17': 'rebootFromConsole',
18: 'rapOverAir', '18': 'rapOverAir',
19: 'powerLow', '19': 'powerLow',
20: 'crash', '20': 'crash',
21: 'powerHigh', '21': 'powerHigh',
22: 'powerLoss', '22': 'powerLoss',
23: 'powerChange', '23': 'powerChange',
24: 'componentFailure', '24': 'componentFailure',
25: 'watchdog', '25': 'watchdog',
} }
_enable_disable = { _enable_disable = {
0: 'N/A', '0': 'N/A',
1: 'enabled', '1': 'enabled',
2: 'disabled', '2': 'disabled',
} }
_failover_pirority = { _failover_pirority = {
0: 'N/A', '0': 'N/A',
1: 'low', '1': 'low',
2: 'medium', '2': 'medium',
3: 'high', '3': 'high',
4: 'critical', '4': 'critical',
} }
_power_status = { _power_status = {
0: 'N/A', '0': 'N/A',
1: 'low', '1': 'low',
2: '15.4W', '2': '15.4W',
3: '16.8W', '3': '16.8W',
4: 'full', '4': 'full',
5: 'external', '5': 'external',
6: 'mixedmode', '6': 'mixedmode',
} }
_pwr_injector_selection = { _pwr_injector_selection = {
0: 'N/A', '0': 'N/A',
1: 'unknown', '1': 'unknown',
2: 'installed', '2': 'installed',
3: 'override', '3': 'override',
} }
_monitor_mode_optimization = { _monitor_mode_optimization = {
0: 'N/A', '0': 'N/A',
1: 'all', '1': 'all',
2: 'tracking', '2': 'tracking',
3: 'wips', '3': 'wips',
4: 'none', '4': 'none',
} }
_encryption_supported = { _encryption_supported = {
0: 'N/A', '0': 'N/A',
1: 'yes', '1': 'yes',
2: 'no', '2': 'no',
} }
_inet_address_type = { _inet_address_type = {
0: 'N/A', '0': 'N/A',
1: 'ipv4', '1': 'ipv4',
2: 'ipv6', '2': 'ipv6',
3: 'ipv4z', '3': 'ipv4z',
4: 'ipv6z', '4': 'ipv6z',
16: 'dns', '16': 'dns',
} }
_antenna_band_mode = { _antenna_band_mode = {
0: 'N/A', '0': 'N/A',
1: 'not applicable', '1': 'not applicable',
2: 'single', '2': 'single',
3: 'dual', '3': 'dual',
} }
_venueconfigvenuegroup = { _venueconfigvenuegroup = {
0: 'N/A', '0': 'N/A',
1: 'unspecified', '1': 'unspecified',
2: 'assembly', '2': 'assembly',
3: 'business', '3': 'business',
4: 'educational', '4': 'educational',
5: 'factory and industrial', '5': 'factory and industrial',
6: 'institutional', '6': 'institutional',
7: 'mercantile', '7': 'mercantile',
8: 'residential', '8': 'residential',
9: 'storage', '9': 'storage',
10: 'utility and misc', '10': 'utility and misc',
11: 'vehicular', '11': 'vehicular',
12: 'outdoor', '12': 'outdoor',
} }
_venueconfigvenuetype = { _venueconfigvenuetype = {
0: 'N/A', '0': 'N/A',
1: 'unspecified', '1': 'unspecified',
2: 'unspecified assembly', '2': 'unspecified assembly',
3: 'arena', '3': 'arena',
4: 'stadium', '4': 'stadium',
5: 'passenger terminal', '5': 'passenger terminal',
6: 'amphitheater', '6': 'amphitheater',
7: 'amusement park', '7': 'amusement park',
8: 'place of worship', '8': 'place of worship',
9: 'convention center', '9': 'convention center',
10: 'library', '10': 'library',
11: 'museum', '11': 'museum',
12: 'restaurant', '12': 'restaurant',
13: 'theater', '13': 'theater',
14: 'bar', '14': 'bar',
15: 'coffee shop', '15': 'coffee shop',
16: 'zoo or aquarium', '16': 'zoo or aquarium',
17: 'emergency coordination center', '17': 'emergency coordination center',
18: 'unspecified business', '18': 'unspecified business',
19: 'doctor or dentist office', '19': 'doctor or dentist office',
20: 'bank', '20': 'bank',
21: 'firestation', '21': 'firestation',
22: 'policestation', '22': 'policestation',
23: 'postoffice', '23': 'postoffice',
24: 'professional office', '24': 'professional office',
25: 'research and development facility', '25': 'research and development facility',
26: 'attorney office', '26': 'attorney office',
27: 'unspecified educational', '27': 'unspecified educational',
28: 'school primary', '28': 'school primary',
29: 'school secondary', '29': 'school secondary',
30: 'university or college', '30': 'university or college',
31: 'unspecified factory and industrial', '31': 'unspecified factory and industrial',
32: 'factory', '32': 'factory',
33: 'unspecified institutional', '33': 'unspecified institutional',
34: 'hospital', '34': 'hospital',
35: 'longterm carefacility', '35': 'longterm carefacility',
36: 'alcohol and drug rehabilitation center', '36': 'alcohol and drug rehabilitation center',
37: 'group home', '37': 'group home',
38: 'prison or jail', '38': 'prison or jail',
39: 'unspecified mercantile', '39': 'unspecified mercantile',
40: 'retail store', '40': 'retail store',
41: 'grocery market', '41': 'grocery market',
42: 'auomotive service station', '42': 'auomotive service station',
43: 'shoppin gmall', '43': 'shoppin gmall',
44: 'gas station', '44': 'gas station',
45: 'unspecified residential', '45': 'unspecified residential',
46: 'privat eresidence', '46': 'privat eresidence',
47: 'hotel or motel', '47': 'hotel or motel',
48: 'dormitory', '48': 'dormitory',
49: 'boarding house', '49': 'boarding house',
50: 'unspecified storage', '50': 'unspecified storage',
51: 'unspecified utility', '51': 'unspecified utility',
52: 'unspecified vehicular', '52': 'unspecified vehicular',
53: 'automobile or truck', '53': 'automobile or truck',
54: 'airplane', '54': 'airplane',
55: 'bus', '55': 'bus',
56: 'ferry', '56': 'ferry',
57: 'ship or boat', '57': 'ship or boat',
58: 'train', '58': 'train',
59: 'motorbike', '59': 'motorbike',
60: 'unspecified outdoor', '60': 'unspecified outdoor',
61: 'muni mesh network', '61': 'muni mesh network',
62: 'citypark', '62': 'citypark',
63: 'restarea', '63': 'restarea',
64: 'traffic control', '64': 'traffic control',
65: 'busstop', '65': 'busstop',
66: 'kiosk', '66': 'kiosk',
} }
_apsubmode = { _apsubmode = {
0: 'N/A', '0': 'N/A',
1: 'none', '1': 'none',
2: 'wips', '2': 'wips',
3: 'pppoe', '3': 'pppoe',
4: 'pppoewips', '4': 'pppoewips',
} }
...@@ -248,12 +239,12 @@ def parse_inv_cisco_wlc_aps_lwap(string_table: StringTable): ...@@ -248,12 +239,12 @@ def parse_inv_cisco_wlc_aps_lwap(string_table: StringTable):
'max_#_of_dot11_slots': ap[1], 'max_#_of_dot11_slots': ap[1],
'name': ap[2], 'name': ap[2],
'max_#_of_ethernet_slots': ap[3], 'max_#_of_ethernet_slots': ap[3],
'encryption_supported': _encryption_supported.get(int(ap[23])), 'encryption_supported': _encryption_supported.get(ap[23]),
'tcp_mss': ap[25], 'tcp_mss': ap[25],
'data_encryption': _enable_disable.get(int(ap[26])), 'data_encryption': _enable_disable.get(ap[26]),
'port_number': ap[28], 'port_number': ap[28],
'venue_config_venue_group': _venueconfigvenuegroup.get(int(ap[29])), 'venue_config_venue_group': _venueconfigvenuegroup.get(ap[29]),
'venue_config_venue_type': _venueconfigvenuetype.get(int(ap[30])), 'venue_config_venue_type': _venueconfigvenuetype.get(ap[30]),
'venue_config_venue_name': ap[31], 'venue_config_venue_name': ap[31],
'venue_config_language': ap[32], 'venue_config_language': ap[32],
'trunk_vlan': ap[34], 'trunk_vlan': ap[34],
...@@ -261,49 +252,49 @@ def parse_inv_cisco_wlc_aps_lwap(string_table: StringTable): ...@@ -261,49 +252,49 @@ def parse_inv_cisco_wlc_aps_lwap(string_table: StringTable):
'floor_label': ap[45], 'floor_label': ap[45],
'module_inserted': ap[49], 'module_inserted': ap[49],
'status_columns': { 'status_columns': {
'antenna_band_mode': _antenna_band_mode.get(int(ap[48])), 'antenna_band_mode': _antenna_band_mode.get(ap[48]),
'encryption': _enable_disable.get(int(ap[11])), 'encryption': _enable_disable.get(ap[11]),
'failover_priority': _failover_pirority.get(int(ap[12])), 'failover_priority': _failover_pirority.get(ap[12]),
'power_status': _power_status.get(int(ap[13])), 'power_status': _power_status.get(ap[13]),
'telnet': _enable_disable.get(int(ap[14])), 'telnet': _enable_disable.get(ap[14]),
'ssh': _enable_disable.get(int(ap[15])), 'ssh': _enable_disable.get(ap[15]),
'pwr_pre_std_state': _enable_disable.get(int(ap[16])), 'pwr_pre_std_state': _enable_disable.get(ap[16]),
'pwr_injector_state': _enable_disable.get(int(ap[17])), 'pwr_injector_state': _enable_disable.get(ap[17]),
'pwr_injector_selection': _pwr_injector_selection.get(int(ap[18])), 'pwr_injector_selection': _pwr_injector_selection.get(ap[18]),
'pwr_injector_sw_mac_addr': _render_mac_address(ap[19]), 'pwr_injector_sw_mac_addr': _render_mac_address(ap[19]),
'wips': _enable_disable.get(int(ap[20])), 'wips': _enable_disable.get(ap[20]),
'monitor_mode_optimization': _monitor_mode_optimization.get(int(ap[18])), 'monitor_mode_optimization': _monitor_mode_optimization.get(ap[18]),
'amsdu': _enable_disable.get(int(ap[22])), 'amsdu': _enable_disable.get(ap[22]),
'admin': _enable_disable.get(int(ap[27])), 'admin': _enable_disable.get(ap[27]),
'rogue_detection': _enable_disable.get(int(ap[24])), 'rogue_detection': _enable_disable.get(ap[24]),
'led_state': _enable_disable.get(int(ap[33])), 'led_state': _enable_disable.get(ap[33]),
'trunk_vlan_status': _enable_disable.get(int(ap[35])), 'trunk_vlan_status': _enable_disable.get(ap[35]),
'submode': _apsubmode.get(int(ap[37])), 'submode': _apsubmode.get(ap[37]),
'real_time_stats_mode_enabled': _enable_disable.get(int(ap[38])), 'real_time_stats_mode_enabled': _enable_disable.get(ap[38]),
'upgrade_from_version': ap[39], 'upgrade_from_version': ap[39],
'upgrade_to_version': ap[40], 'upgrade_to_version': ap[40],
'upgrade_failure_cause': ap[41], 'upgrade_failure_cause': ap[41],
'adj_channel_rogue_enabled': ap[46], 'adj_channel_rogue_enabled': ap[46],
'sys_net_id': ap[47], 'sys_net_id': ap[47],
'enable_module': _enable_disable.get(int(ap[50])), 'enable_module': _enable_disable.get(ap[50]),
'is_universal': _enable_disable.get(int(ap[51])), 'is_universal': _enable_disable.get(ap[51]),
'universal_prime_status': ap[52], 'universal_prime_status': ap[52],
'is_master': _enable_disable.get(int(ap[53])), 'is_master': _enable_disable.get(ap[53]),
'ble_fw_download_status': _enable_disable.get(int(ap[54])), 'ble_fw_download_status': _enable_disable.get(ap[54]),
'max_client_limit_number_trap': ap[42], 'max_client_limit_number_trap': ap[42],
'max_client_limit_cause': ap[43], 'max_client_limit_cause': ap[43],
'max_client_limit_set': _enable_disable.get(int(ap[44])), 'max_client_limit_set': _enable_disable.get(ap[44]),
'wlc_primary_address': wlcprimaryaddress, 'wlc_primary_address': wlcprimaryaddress,
'wlc_secondary_address': wlcsecondaryaddress, 'wlc_secondary_address': wlcsecondaryaddress,
'wlc_tertiary_address': wlctertiaryaddress, 'wlc_tertiary_address': wlctertiaryaddress,
'last_reboot_reason': _last_reboot_reason.get(int(ap[10])), 'last_reboot_reason': _last_reboot_reason.get(ap[10]),
} }
}) })
return aps return aps
def inventory_wlc_aps_lwap(params, section) -> InventoryResult: def inventory_cisco_wlc_aps_lwap(params, section) -> InventoryResult:
removecolumns = [] removecolumns = []
if params: if params:
...@@ -317,24 +308,22 @@ def inventory_wlc_aps_lwap(params, section) -> InventoryResult: ...@@ -317,24 +308,22 @@ def inventory_wlc_aps_lwap(params, section) -> InventoryResult:
for key in key_columns.keys(): for key in key_columns.keys():
ap.pop(key) ap.pop(key)
status_columns = ap['status_columns']
ap.pop('status_columns')
for entry in removecolumns: for entry in removecolumns:
try: try:
ap.pop(entry) ap.pop(entry)
except KeyError: except KeyError:
pass pass
status_columns = ap.get('status_columns', None)
for entry in removecolumns: for entry in removecolumns:
try: try:
status_columns.pop(entry) status_columns.pop(entry)
except KeyError: except KeyError:
pass pass
try:
ap.pop('status_columns')
except KeyError:
pass
yield TableRow( yield TableRow(
path=path, path=path,
key_columns=key_columns, key_columns=key_columns,
...@@ -342,6 +331,7 @@ def inventory_wlc_aps_lwap(params, section) -> InventoryResult: ...@@ -342,6 +331,7 @@ def inventory_wlc_aps_lwap(params, section) -> InventoryResult:
status_columns=status_columns, status_columns=status_columns,
) )
register.snmp_section( register.snmp_section(
name='inv_cisco_wlc_aps_lwap', name='inv_cisco_wlc_aps_lwap',
parse_function=parse_inv_cisco_wlc_aps_lwap, parse_function=parse_inv_cisco_wlc_aps_lwap,
...@@ -412,8 +402,7 @@ register.snmp_section( ...@@ -412,8 +402,7 @@ register.snmp_section(
register.inventory_plugin( register.inventory_plugin(
name='inv_cisco_wlc_aps_lwap', name='inv_cisco_wlc_aps_lwap',
inventory_function=inventory_wlc_aps_lwap, inventory_function=inventory_cisco_wlc_aps_lwap,
inventory_default_parameters={}, inventory_default_parameters={},
inventory_ruleset_name='inv_cisco_wlc_ap_cdp_cache', inventory_ruleset_name='inv_cisco_wlc_aps_lwap',
) )
No preview for this file type
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import cmk.gui.utils
from cmk.gui.plugins.views import ( from cmk.gui.plugins.views import (
inventory_displayhints,) inventory_displayhints,)
from cmk.gui.i18n import _ from cmk.gui.i18n import _
from cmk.gui.plugins.views.inventory import declare_invtable_view
inventory_displayhints.update({ inventory_displayhints.update({
...@@ -67,6 +67,4 @@ inventory_displayhints.update({ ...@@ -67,6 +67,4 @@ inventory_displayhints.update({
'.networking.wlan.controller.accesspoints_lwap:*.ble_fw_download_status' : {'title': _('Ble FW downaload status')}, '.networking.wlan.controller.accesspoints_lwap:*.ble_fw_download_status' : {'title': _('Ble FW downaload status')},
}) })
from cmk.gui.plugins.views.inventory import declare_invtable_view
declare_invtable_view('invwlcapslwap', '.networking.wlan.controller.accesspoints_lwap:', _('Cisco WLC APs LWAP info'), _('Cisco WLC APs LWAP info)')) declare_invtable_view('invwlcapslwap', '.networking.wlan.controller.accesspoints_lwap:', _('Cisco WLC APs LWAP info'), _('Cisco WLC APs LWAP info)'))
...@@ -16,7 +16,7 @@ from cmk.gui.plugins.wato.inventory import ( ...@@ -16,7 +16,7 @@ from cmk.gui.plugins.wato.inventory import (
RulespecGroupInventory, RulespecGroupInventory,
) )
removecolumns = [ _removecolumns = [
('adj_channel_rogue_enabled', 'Adj. channel rogue'), ('adj_channel_rogue_enabled', 'Adj. channel rogue'),
('admin', 'Admin state'), ('admin', 'Admin state'),
('amsdu', 'Aggregate MAC Service Data Unit'), ('amsdu', 'Aggregate MAC Service Data Unit'),
...@@ -78,7 +78,7 @@ def _valuespec_inv_cisco_wlc_aps_lwap(): ...@@ -78,7 +78,7 @@ def _valuespec_inv_cisco_wlc_aps_lwap():
ListChoice( ListChoice(
title=_('list of columns to remove'), title=_('list of columns to remove'),
help=_('information to remove from inventory'), help=_('information to remove from inventory'),
choices=removecolumns, choices=_removecolumns,
default_value=[ default_value=[
'adj_channel_rogue_enabled', 'amsdu', 'is_master', 'is_universal', 'submode', 'adj_channel_rogue_enabled', 'amsdu', 'is_master', 'is_universal', 'submode',
'universal_prime_status', 'max_client_limit_cause', 'ble_fw_download_status', 'antenna_band_mode', 'universal_prime_status', 'max_client_limit_cause', 'ble_fw_download_status', 'antenna_band_mode',
......
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