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

update project

parent 5008c3cf
No related branches found
No related tags found
No related merge requests found
2021-07-01: extended if64 to use ifName instead of ifDescr 2021-07-01: extended if64 to use ifName instead of ifDescr
2021-09-29: fixed empty interface name handling
2023-03-02: changed for CMK 2.1.x
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
# #
# extended if64 to use ifNAme instead of ifDescr # extended if64 to use ifNAme instead of ifDescr
# #
# 2021-0929: fixed empty interface name handling # 2021-09-29: fixed empty interface name handling
# 2023-03-02: changed for CMK 2.1.x
# #
from typing import ( from typing import (
...@@ -21,6 +22,11 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import ( ...@@ -21,6 +22,11 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import (
SNMPTree, SNMPTree,
type_defs, type_defs,
) )
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
StringByteTable,
)
from cmk.base.plugins.agent_based.utils import if64, interfaces from cmk.base.plugins.agent_based.utils import if64, interfaces
_interface_displayhints = { _interface_displayhints = {
...@@ -54,8 +60,8 @@ def _get_short_if_name(ifname: str) -> str: ...@@ -54,8 +60,8 @@ def _get_short_if_name(ifname: str) -> str:
return ifname return ifname
def parse_if64name(string_table: List[type_defs.StringByteTable]) -> interfaces.Section: def parse_if64name(string_table: StringByteTable) -> interfaces.Section:
for interface in string_table[0]: for interface in string_table:
if interface[-1] != '': if interface[-1] != '':
interface[1] = interface[-1] # replace ifDescr with ifName (.1.3.6.1.2.1.31.1.1.1.1) interface[1] = interface[-1] # replace ifDescr with ifName (.1.3.6.1.2.1.31.1.1.1.1)
interface[1] = _get_short_if_name(interface[1]) # ifDescr (.1.3.6.1.2.1.2.2.1.2) interface[1] = _get_short_if_name(interface[1]) # ifDescr (.1.3.6.1.2.1.2.2.1.2)
...@@ -67,12 +73,10 @@ register.snmp_section( ...@@ -67,12 +73,10 @@ register.snmp_section(
name='if64name', name='if64name',
parsed_section_name='if64', parsed_section_name='if64',
parse_function=parse_if64name, parse_function=parse_if64name,
fetch=[ fetch= SNMPTree(
SNMPTree(
base=if64.BASE_OID, base=if64.BASE_OID,
oids=if64.END_OIDS + ['31.1.1.1.1'] # IF-MIB::ifName, oids=if64.END_OIDS + ['31.1.1.1.1'] # IF-MIB::ifName,
), ),
],
detect=if64.HAS_ifHCInOctets, detect=if64.HAS_ifHCInOctets,
supersedes=['if64', 'interfaces', 'if', 'statgrab_net'], supersedes=['if64', 'interfaces', 'if', 'statgrab_net'],
) )
No preview for this file type
...@@ -9,9 +9,8 @@ ...@@ -9,9 +9,8 @@
'download_url': 'https://thl-cmk.hopto.org', 'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['if64name.py']}, 'files': {'agent_based': ['if64name.py']},
'name': 'if64name', 'name': 'if64name',
'num_files': 1,
'title': 'ifName extension for if64', 'title': 'ifName extension for if64',
'version': '20210929.v0.0.1a', 'version': '20230302.v0.0.2',
'version.min_required': '2.0.0', 'version.min_required': '2.1.0',
'version.packaged': '2021.09.20', 'version.packaged': '2.1.0p22',
'version.usable_until': None} 'version.usable_until': None}
\ No newline at end of file
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