diff --git a/agent_based/cisco_bgp_peer.py b/agent_based/cisco_bgp_peer.py index 9fe944edf48ae6857ccc84a41446433b055afe37..cf4d73a1a4dd483364c574aa9489def5e392a782 100644 --- a/agent_based/cisco_bgp_peer.py +++ b/agent_based/cisco_bgp_peer.py @@ -9,6 +9,13 @@ # # Monitor status of Cisco BGP Peers (IPv4 and IPv6) # +# ToDo: move longoutput to inventory, based on inv_bgp_peer +# ToDo: move helper functions to utils/bgp_peer, merge with bgp_peer +# ToDo: merge WATO with bgp_peer +# ToDo: merge metrics with bgp_peer +# ToDo: merge check function with bgp_peer +# goal: only snmp_section and parse function left +# # 2018-05-24: changed counters to 1/s # 2018-05-25: a lot of code cleanup # packet name changed from cisco_bgp to cisco_bgp_peer @@ -39,6 +46,7 @@ # 2021-08-22: added WATO option for admin state down # 2021-08-23: changed service name from "Cisco BGP peer" to "BGP peer" --> streamline with bgp_peer # get localas from BGP-4-MIB::bgpLocalAs if CISCO-BGP4-MIB::cbgpPeer2LocalAs not set +# 2021-08-29: fixed bgpLocalAs in BGP-4-MIB not set import re import time @@ -229,7 +237,10 @@ def parse_cisco_bgp_peer(string_table: List[StringTable]) -> Dict[str, Peer]: cbgpPeer2Entry, cbgpPeer2AddrFamily, bgpLocalAs = string_table # local as from BGP-4-MIB - bgpLocalAs = bgpLocalAs[0][0] + try: + bgpLocalAs = bgpLocalAs[0][0] + except (IndexError): + bgpLocalAs = 'N/A' # create dictionary from cbgpPeer2Entry (peer ip address as index) peer_table = {} diff --git a/cisco_bgp_peer.mkp b/cisco_bgp_peer.mkp index 80bcb383198a032e785f1d71e25bf5355ed89e8f..636303dba04e990957156bc38b66c04b1a4b97fd 100644 Binary files a/cisco_bgp_peer.mkp and b/cisco_bgp_peer.mkp differ