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