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

update project

parent 3dee37d3
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,8 @@
#
# 2022-04-30: code cleanup/streamlining
# 2022-05-09: added item to BgpPeer class, this is used in the discovery function
# 2022-05-11: changed bgp_get_peer_entry to get proper parameters instead of Nontransparent list
# added remote_as to BgpPeerItem
#
import copy
......@@ -78,31 +80,36 @@ def parse_juniper_bgp_peer(string_table: List[StringByteTable]) -> Optional[Dict
peer_prefixes[index] = [prefixes]
for entry in jnxBgpM2Peer:
# extract values and adjust format
oid_end = entry[0]
entry.pop(0)
PeerRemoteAddrType = entry[0]
entry.pop(0)
PeerIndex = entry[0]
entry.pop(0)
PeerRoutingInstance = entry[0]
entry.pop(0)
remote_address = bgp_render_ip_address(PeerRemoteAddrType, entry[0])
entry[0] = remote_address
bgp_peer = bgp_get_peer_entry(entry)
prefixes = peer_prefixes.get(PeerIndex, [])
oid_end, peer_state, admin_state, remote_addr_type, remote_addr, remote_as, peer_index, routing_instance, \
in_updates, out_updates, in_messages, out_messages, fsm_established_transitions, fsm_established_time, \
in_update_elapsed_time = entry
remote_addr = bgp_render_ip_address(remote_addr_type, remote_addr)
bgp_peer = bgp_get_peer_entry(
remote_addr=remote_addr,
peer_state=peer_state,
admin_state=admin_state,
remote_as=remote_as,
in_updates=in_updates,
out_updates=out_updates,
in_messages=in_messages,
out_messages=out_messages,
fsm_established_transitions=fsm_established_transitions,
fsm_established_time=fsm_established_time,
in_update_elapsed_time=in_update_elapsed_time
)
prefixes = peer_prefixes.get(peer_index, [])
for address_family in prefixes:
address_family_str = juniper_afi_safi_mapping(address_family.afi, address_family.safi)
item = f'{remote_address} {address_family_str}'
item = f'{remote_addr} {address_family_str}'
# ToDo: add vrf name
routing_instance = ''
if PeerRoutingInstance != '0':
routing_instance = f'VR {PeerRoutingInstance}'
if routing_instance != '0':
routing_instance = f'VR {routing_instance}'
item = f'{item} {routing_instance}'
peer_table[item] = copy.deepcopy(bgp_peer[remote_address])
peer_table[item] = copy.deepcopy(bgp_peer[remote_addr])
peer_table[item].accepted_prefixes = address_family.accepted_prefixes
peer_table[item].metric_count += address_family.metric_count
peer_table[item].metric_rate += address_family.metric_rate
......@@ -115,19 +122,19 @@ register.snmp_section(
name='juniper_bgp_peer',
parse_function=parse_juniper_bgp_peer,
parsed_section_name='bgp_peer',
supersedes=['bgp_peer'],
supersedes=['bgp_peer', 'juniper_bgp_state'],
fetch=[
SNMPTree(
base='.1.3.6.1.4.1.2636.5.1.1.2', # BGP4-V2-MIB-JUNIPER::jnxBgpM2Peer
oids=[
OIDEnd(),
'1.1.1.2', # jnxBgpM2PeerState
'1.1.1.3', # jnxBgpM2PeerStatus (admin status(?))
'1.1.1.10', # jnxBgpM2PeerRemoteAddrType
OIDBytes('1.1.1.11'), # jnxBgpM2PeerRemoteAddr
'1.1.1.13', # jnxBgpM2PeerRemoteAs
'1.1.1.14', # jnxBgpM2PeerIndex
'1.1.1.15', # jnxBgpM2PeerRoutingInstance
# needs to be in this order to match bgp_peer
OIDBytes('1.1.1.11'), # jnxBgpM2PeerRemoteAddr
'1.1.1.2', # jnxBgpM2PeerState
'1.1.1.3', # jnxBgpM2PeerStatus (admin status(?))
'6.1.1.1', # jnxBgpM2PeerInUpdates
'6.1.1.2', # jnxBgpM2PeerOutUpdates
'6.1.1.3', # jnxBgpM2PeerInTotalMessages
......@@ -158,3 +165,4 @@ register.snmp_section(
# 1.3.6.1.4.1.2636.5.1.1.2.8.1.1.1
# stop(1)
# start(2)
No preview for this file type
......@@ -14,7 +14,7 @@
'name': 'juniper_bgp_peer',
'num_files': 3,
'title': 'Juniper BGP peer',
'version': '20220509.v.0.0.4',
'version': '20220511.v.0.0.5',
'version.min_required': '2.0.0',
'version.packaged': '2021.09.20',
'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