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

update project

parent 83588bfe
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,7 @@
# 'version': 'v 3.1.2.2'
# }
from typing import List, NamedTuple, Optional, Dict, Any
from typing import List, Dict, Any
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
StringTable,
......@@ -92,29 +92,40 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import (
startswith,
)
_device_activated = {
'1': 'True',
'2': 'False'
}
def parse_inv_espm(string_table: List[StringTable]) -> Dict[str, Any]: # Dict[str, str, List[Dict[str, str]]:
_device_detected = {
'1': 'True',
'2': 'False'
}
def parse_inv_espm(string_table: List[StringTable]) -> Dict[str, Any]:
version, devices = string_table
section = {}
section['devices'] = []
section['version'] = version[0][0]
for deviceid, devicename, deviceactivated, devicedetected, devicetype, deviceversion in devices:
section = {
'devices': [],
'version': version[0][0]
}
for deviceid, devicename, deviceactivated, devicedetected, devicetype, deviceversion in devices:
section['devices'].append({
'id': deviceid,
'name': devicename,
'type': devicetype,
'version': deviceversion,
'status_columns': {
'activated': deviceactivated,
'detected': devicedetected,
'activated': _device_activated.get(deviceactivated, deviceactivated),
'detected': _device_detected.get(devicedetected, devicedetected),
},
})
return section
def inventory_hw_modules(params, section: Dict[str, Any]) -> InventoryResult:
def inventory_hw_modules(section: Dict[str, Any]) -> InventoryResult:
path = ['hardware', 'system']
yield Attributes(
......@@ -133,6 +144,7 @@ def inventory_hw_modules(params, section: Dict[str, Any]) -> InventoryResult:
status_columns = device['status_columns']
device.pop('status_columns')
yield TableRow(
path=path,
key_columns=key_columns,
......@@ -169,6 +181,4 @@ register.snmp_section(
register.inventory_plugin(
name='inv_espm',
inventory_function=inventory_hw_modules,
inventory_default_parameters={},
inventory_ruleset_name='inv_espm',
)
No preview for this file type
{'author': 'Th.L. (thl-cmk[at]outlook[dot]com)',
'description': 'Inventory Neols ePowerSwitch ',
'description': 'Inventory Neols ePowerSwitch \n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['inv_epsm.py']},
'files': {'agent_based': ['inv_epsm.py'],
'web': ['plugins/views/inv_epsm.py']},
'name': 'inv_epsm',
'num_files': 1,
'num_files': 2,
'title': 'Neol ePowerswitch inventory',
'version': '20211127.v.0.0.1',
'version.min_required': '2.0.0',
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
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({
'.hardware.devices:': {'title': _('Devices'),
'keyorder': ['id', 'name', 'type', 'version', 'detected', 'activated', ],
'view': 'invdevices_of_host',
},
'.hardware.devices:*.id': {'title': _('ID'), },
'.hardware.devices:*.name': {'title': _('Name')},
'.hardware.devices:*.type': {'title': _('Type'), },
'.hardware.devices:*.version': {'title': _('Version')},
'.hardware.devices:*.detected': {'title': _('Detected'), },
'.hardware.devices:*.activated': {'title': _('Activated'), },
})
declare_invtable_view('invdevices', '.hardware.devices:', _('Devices'), _('Devices'))
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