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

update project

parent 80902ee2
No related branches found
No related tags found
No related merge requests found
...@@ -132,6 +132,9 @@ def check_bgp_peer(item, params, section: Dict[str, BgpPeer]) -> CheckResult: ...@@ -132,6 +132,9 @@ def check_bgp_peer(item, params, section: Dict[str, BgpPeer]) -> CheckResult:
yield Result(state=State(neighborstate.get(str(peer.peer_state))), notice=f'Peer state: {peer.peer_statestr}') yield Result(state=State(neighborstate.get(str(peer.peer_state))), notice=f'Peer state: {peer.peer_statestr}')
if peer.peer_unavail_reason != 0: # huawei peer unavailable state
yield Result(state=State.CRIT, notice=F'Peer unavailable reason: {peer.peer_unavail_reason_str}')
acceptedprefixes = peer.accepted_prefixes acceptedprefixes = peer.accepted_prefixes
prefixadminlimit = peer.prefix_admin_limit prefixadminlimit = peer.prefix_admin_limit
prefixthreshold = peer.prefix_threshold prefixthreshold = peer.prefix_threshold
......
...@@ -9,8 +9,11 @@ ...@@ -9,8 +9,11 @@
# #
# include file, will be used with bgp_peer, inv_bgp_peer, cisco_bgp_peer, inv_cisco_bgp_peer # include file, will be used with bgp_peer, inv_bgp_peer, cisco_bgp_peer, inv_cisco_bgp_peer
# #
# 2022-04-17: added peer_unavail_reason/peer_unavail_reason_str for huawei bgp peers
#
import re import re
from typing import List, Tuple, Optional,Dict from typing import List, Tuple, Optional, Dict
from dataclasses import dataclass from dataclasses import dataclass
...@@ -27,6 +30,8 @@ class BgpPeer: ...@@ -27,6 +30,8 @@ class BgpPeer:
prefix_threshold: Optional[int] prefix_threshold: Optional[int]
prefix_clear_threshold: Optional[int] prefix_clear_threshold: Optional[int]
accepted_prefixes: Optional[int] accepted_prefixes: Optional[int]
peer_unavail_reason: Optional[int]
peer_unavail_reason_str: Optional[str]
def sec2hr(seconds): def sec2hr(seconds):
...@@ -184,6 +189,8 @@ def bgp_get_peer_entry(peer: List) -> Optional[Dict[str, BgpPeer]]: ...@@ -184,6 +189,8 @@ def bgp_get_peer_entry(peer: List) -> Optional[Dict[str, BgpPeer]]:
prefix_threshold=None, prefix_threshold=None,
prefix_clear_threshold=None, prefix_clear_threshold=None,
accepted_prefixes=None, accepted_prefixes=None,
peer_unavail_reason=0,
peer_unavail_reason_str='',
) )
for key, value in [ for key, value in [
...@@ -194,7 +201,7 @@ def bgp_get_peer_entry(peer: List) -> Optional[Dict[str, BgpPeer]]: ...@@ -194,7 +201,7 @@ def bgp_get_peer_entry(peer: List) -> Optional[Dict[str, BgpPeer]]:
]: ]:
try: try:
bgp_peer.metric_rate.append((key, int(value))) bgp_peer.metric_rate.append((key, int(value)))
except ValueError: except (ValueError, TypeError):
pass pass
for key, value in [ for key, value in [
...@@ -203,7 +210,7 @@ def bgp_get_peer_entry(peer: List) -> Optional[Dict[str, BgpPeer]]: ...@@ -203,7 +210,7 @@ def bgp_get_peer_entry(peer: List) -> Optional[Dict[str, BgpPeer]]:
]: ]:
try: try:
bgp_peer.metric_count.append((key, int(value))) bgp_peer.metric_count.append((key, int(value)))
except ValueError: except (ValueError, TypeError):
pass pass
return {remote_addr: bgp_peer} return {remote_addr: bgp_peer}
No preview for this file type
...@@ -88,6 +88,8 @@ metric_info['bgp_peer_suppressedprefixes'] = { ...@@ -88,6 +88,8 @@ metric_info['bgp_peer_suppressedprefixes'] = {
} }
###################################################################################################################### ######################################################################################################################
# #
# how to graph perdata for bgp peer # how to graph perdata for bgp peer
......
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