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

update project

parent c221974b
No related branches found
No related tags found
No related merge requests found
......@@ -47,8 +47,9 @@
# 2021-11-13: fix for mixed peers (with and without prefixes on one host)
# 2021-11-14: merged check function with bgp_peer
# merged parse function with bgp_peer
# added basic support for VRFs (cbgpPeer3Entry)
from typing import List, Dict
from typing import List, Dict, Optional
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
......@@ -57,9 +58,11 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import (
contains,
all_of,
OIDEnd,
OIDBytes,
)
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
StringTable,
StringByteTable,
)
from cmk.base.plugins.agent_based.utils.bgp_peer import (
......@@ -178,6 +181,80 @@ register.snmp_section(
),
)
###########################################################################
#
# cisco_bgp_peer (CISCO-BGP4-MIB:cbgpPeer3Entry)
#
###########################################################################
# ToDo: add support for non ipv6, needs sample
def parse_cisco_bgp_peer_3(string_table: StringByteTable) -> Optional[Dict[str, BgpPeer]]:
peer_table = {}
for entry in string_table:
if entry[0] == '1': # IPv4 address
entry[1] = '.'.join(f'{m}' for m in entry[1])
if entry[2] != 'default':
entry[1] += f' vrf {entry[2]}'
entry.pop(2) # remove vrf name
entry.pop(0) # remove remote address type
bgp_peer = bgp_get_peer_entry(entry)
if bgp_peer:
peer_table.update(bgp_peer)
return peer_table
register.snmp_section(
name='cisco_bgp_peer_3',
parse_function=parse_cisco_bgp_peer_3,
parsed_section_name='bgp_peer',
supersedes=['bgp_peer', 'cisco_bgp_peer'],
fetch= SNMPTree(
base='.1.3.6.1.4.1.9.9.187.1.2.9.1', # CISCO-BGP4-MIB::cbgpPeer3Entry
oids=[
'2', # cbgpPeer3Type
OIDBytes('3'), # cbgpPeer3RemoteAddr
'4', # cbgpPeer3VrfName
'5', # cbgpPeer3State
'6', # cbgpPeer3AdminStatus
'15', # cbgpPeer3InUpdates
'16', # cbgpPeer3OutUpdates
'17', # cbgpPeer3InTotalMessages
'18', # cbgpPeer3OutTotalMessages
'20', # cbgpPeer3FsmEstablishedTransitions
'21', # cbgpPeer3FsmEstablishedTime
'29', # cbgpPeer3InUpdateElapsedTime
]
),
detect=all_of(
contains('.1.3.6.1.2.1.1.1.0', 'Cisco'),
exists('.1.3.6.1.4.1.9.9.187.1.2.9.1.3.*')
),
)
# '1', # cbgpPeer3VrfId
# '3', # cbgpPeer3RemoteAddr
# '4', # cbgpPeer3VrfName
# '5', # cbgpPeer3State
# '6', # cbgpPeer3AdminStatus
# '7', # cbgpPeer3NegotiatedVersion
# '8', # cbgpPeer3LocalAddr
# '9', # cbgpPeer3LocalPort
# '10', # cbgpPeer3LocalAs
# '11', # cbgpPeer3LocalIdentifier
# '12', # cbgpPeer3RemotePort
# '13', # cbgpPeer3RemoteAs
# '14', # cbgpPeer3RemoteIdentifier
# '19', # cbgpPeer3LastError
# '22', # cbgpPeer3ConnectRetryInterval
# '23', # cbgpPeer3HoldTime
# '24', # cbgpPeer3KeepAlive
# '25', # cbgpPeer3HoldTimeConfigured
# '26', # cbgpPeer3KeepAliveConfigured
# '27', # cbgpPeer3MinASOriginationInterval
# '28', # cbgpPeer3MinRouteAdvertisementInterval
# '30', # cbgpPeer3LastErrorTxt
# '31', # cbgpPeer3PrevState
###########################################################################
#
......
No preview for this file type
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