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

modified for check APIv2

parent 2184e500
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/inv_ifname-0.3.1-20240722.mkp "inv_ifname-0.3.1-20240722.mkp"
[PACKAGE]: ../../raw/master/mkp/inv_ifname-0.3.2-20250323.mkp "inv_ifname-0.3.2-20250323.mkp"
# inventory of interface names
adds the following to the inventory:
......
File added
......@@ -13,8 +13,9 @@
# 2023-06-03: moved gui files to ~/local/lib/chek_mk/gui/plugins/...
# 2023-06-15: added key_columns: desc and alias to match CMK 2.2.x
# 2023-09-01: fix parse function if both interface tables don't match (THX to joerg[dot]ott[at]outlook[dot]com)
# 2024-04-19: refactoring for CMK2.3.0b5 (removed decription/alias), only if_index is key column now again.
# 2024-04-19: refactoring for CMK2.3.0b5 (removed description/alias), only if_index is key column now again.
# 2024-07-22: detect function changed to check if IF-MIB::ifXTable.ifName exists
# 2025-03-23: modified for CMK 2.4.0x
# sample snmpwalk
# .1.3.6.1.2.1.31.1.1.1.1.1 = STRING: lo
......@@ -28,20 +29,14 @@
# .1.3.6.1.2.1.31.1.1.1.1.9 = STRING: bond1.3001
#
from typing import Mapping
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
StringTable,
from cmk.agent_based.v2 import (
InventoryPlugin,
InventoryResult,
)
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
OIDEnd,
)
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
SNMPSection,
SNMPTree,
StringTable,
TableRow,
exists,
)
......@@ -65,7 +60,7 @@ def inventory_inv_ifname(section: Mapping[int, str]) -> InventoryResult:
)
register.snmp_section(
if_name_snmp_section = SNMPSection(
name='inv_ifname',
parse_function=parse_inv_ifname,
fetch= SNMPTree(
......@@ -79,7 +74,7 @@ register.snmp_section(
detect=exists('.1.3.6.1.2.1.31.1.1.1.1.*'),
)
register.inventory_plugin(
if_name_inventory_plugin = InventoryPlugin(
name='inv_ifname',
inventory_function=inventory_inv_ifname,
)
{'author': 'Th.L. (thl-cmk[at]outlook[dot]com)',
'description': 'Adds the interface name to the inventory\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['inv_ifname.py'],
'files': {'cmk_addons_plugins': ['inventory/agent_based/inv_ifname.py'],
'web': ['plugins/views/inv_ifname.py']},
'name': 'inv_ifname',
'title': 'Add interface name to inventory',
'version': '0.3.1-20240722',
'version': '0.3.2-20250323',
'version.min_required': '2.3.0b4',
'version.packaged': 'cmk-mkp-tool 0.2.0',
'version.usable_until': '2.4.0b1'}
'version.usable_until': '2.5.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