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

update project

parent 9142c090
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@
# added type hinting for parsed data (section)
# optimised data handling in check function (add prefixes to peer info)
# made default state if item not found configurable via WALO
# 2021-07-21: fixed missing oid_end in parse function, thanks to oliverj@cmkforum
#
#
#
......@@ -428,29 +429,31 @@ def parse_cisco_bgp_peer(string_table: List[StringTable]) -> Section:
oid_end, addrfamilyname, acceptedprefixes, deniedprefixes, prefixadminlimit, prefixthreshold, \
prefixclearthreshold, advertisedprefixes, suppressedprefixes, withdrawnprefixes = entry
remoteaddr = _cisco_bgp_get_peer(oid_end)
prefixes = Prefixes()
prefixes.update({
'remoteaddr': remoteaddr,
'addrfamilyname': addrfamilyname
})
for key, value in [
('prefixadminlimit', prefixadminlimit),
('prefixthreshold', prefixthreshold),
('prefixclearthreshold', prefixclearthreshold),
('acceptedprefixes', acceptedprefixes),
('advertisedprefixes', advertisedprefixes),
('deniedprefixes', deniedprefixes),
('suppressedprefixes', suppressedprefixes),
('withdrawnprefixes', withdrawnprefixes),
]:
try:
prefixes[key] = int(value)
except ValueError:
pass
prefixes_table.update({'%s %s' % (remoteaddr, addrfamilyname): prefixes})
if not oid_end == '':
remoteaddr = _cisco_bgp_get_peer(oid_end)
prefixes = Prefixes()
prefixes.update({
'remoteaddr': remoteaddr,
'addrfamilyname': addrfamilyname
})
for key, value in [
('prefixadminlimit', prefixadminlimit),
('prefixthreshold', prefixthreshold),
('prefixclearthreshold', prefixclearthreshold),
('acceptedprefixes', acceptedprefixes),
('advertisedprefixes', advertisedprefixes),
('deniedprefixes', deniedprefixes),
('suppressedprefixes', suppressedprefixes),
('withdrawnprefixes', withdrawnprefixes),
]:
try:
prefixes[key] = int(value)
except ValueError:
pass
prefixes_table.update({'%s %s' % (remoteaddr, addrfamilyname): prefixes})
# workaround: get remote ip from cbgpPeer2Entry if cbgpPeer2AddrFamilyName is missing :-(
elif len(cbgpPeer2Entry) > 0:
......@@ -469,34 +472,35 @@ def parse_cisco_bgp_peer(string_table: List[StringTable]) -> Section:
outupdates, intotalmessages, outtotalmessages, lasterror, fsmestablishedtransitions, fsmestablishedtime, \
inupdateelapsedtime, lasterrortxt, prevstate = entry
peer = {'remoteaddr': _cisco_bgp_get_peer(oid_end),
'localaddr': _bgp_render_ip_address(localaddr),
'localid': localidentifier,
'remoteid': remoteidentifier,
'lasterror': _cisco_bgp_errors(lasterror),
'lasterrortxt': lasterrortxt,
'prevstate': int(prevstate),
}
for key, value in [
('state', state),
('adminstate', adminstatus),
('localas', localas),
('remoteas', remoteas),
('inupdates', inupdates),
('outupdates', outupdates),
('intotalmessages', intotalmessages),
('outtotalmessages', outtotalmessages),
('fsmestablishedtransitions', fsmestablishedtransitions),
('fsmestablishedtime', fsmestablishedtime),
('inupdateelapsedtime', inupdateelapsedtime),
]:
try:
peer[key] = int(value)
except ValueError:
pass
if not oid_end == '':
peer = {'remoteaddr': _cisco_bgp_get_peer(oid_end),
'localaddr': _bgp_render_ip_address(localaddr),
'localid': localidentifier,
'remoteid': remoteidentifier,
'lasterror': _cisco_bgp_errors(lasterror),
'lasterrortxt': lasterrortxt,
'prevstate': int(prevstate),
}
for key, value in [
('state', state),
('adminstate', adminstatus),
('localas', localas),
('remoteas', remoteas),
('inupdates', inupdates),
('outupdates', outupdates),
('intotalmessages', intotalmessages),
('outtotalmessages', outtotalmessages),
('fsmestablishedtransitions', fsmestablishedtransitions),
('fsmestablishedtime', fsmestablishedtime),
('inupdateelapsedtime', inupdateelapsedtime),
]:
try:
peer[key] = int(value)
except ValueError:
pass
peer_table.update({'%s' % _cisco_bgp_get_peer(oid_end): peer})
peer_table.update({'%s' % _cisco_bgp_get_peer(oid_end): peer})
return Section(
prefixes_table=prefixes_table,
......
No preview for this file type
......@@ -15,12 +15,13 @@
'v0.3: rewrite for CMK 2.0\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['cisco_bgp_peer.py'],
'checkman': ['cisco_bgp_peer'],
'web': ['plugins/wato/cisco_bgp_peer.py',
'plugins/metrics/cisco_bgp_peer.py']},
'name': 'cisco_bgp_peer',
'num_files': 3,
'num_files': 4,
'title': 'Cisco BGP Peer',
'version': '20210713.v.0.3c',
'version': '20210721.v.0.3d',
'version.min_required': '2.0.0',
'version.packaged': '2021.07.14',
'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