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

update project

parent d3132d29
No related branches found
No related tags found
No related merge requests found
......@@ -336,7 +336,6 @@ def parse_cisco_bgp_peer(string_table: List[StringTable]):
'localid': localidentifier,
'remoteid': remoteidentifier,
'lasterror': cisco_bgp_errors(lasterror),
'inupdateelapsedtime': inupdateelapsedtime,
'lasterrortxt': lasterrortxt,
'prevstate': int(prevstate),
}
......@@ -352,6 +351,7 @@ def parse_cisco_bgp_peer(string_table: List[StringTable]):
('outtotalmessages', outtotalmessages),
('fsmestablishedtransitions', fsmestablishedtransitions),
('fsmestablishedtime', fsmestablishedtime),
('inupdateelapsedtime', inupdateelapsedtime),
]:
try:
peer[key] = int(value)
......@@ -423,7 +423,6 @@ def check_cisco_bgp_peer(item, params, section) -> CheckResult:
peer_not_found_state = not_found_state
if prefixes:
infotext = ''
longoutput = ''
minuptime = 86400
......@@ -438,7 +437,7 @@ def check_cisco_bgp_peer(item, params, section) -> CheckResult:
infotext_values = params.get('infotext_values', [])
if alias != '':
infotext += ', Alias: %s' % alias
yield Result(state=State.OK, summary='Alias: %s' % alias)
for key, value in [
('remoteid', ', Remote ID: %s'),
......@@ -449,7 +448,7 @@ def check_cisco_bgp_peer(item, params, section) -> CheckResult:
]:
if key not in infotext_values:
try:
infotext += value % peer[key]
yield Result(state=State.OK, value=value % peer[key])
except KeyError:
pass
......@@ -461,7 +460,7 @@ def check_cisco_bgp_peer(item, params, section) -> CheckResult:
yield Result(state=State.CRIT, summary='Peer state: %s' % cisco_bgp_peerstate(peerstate))
elif peerstate == 6: # established
if establishedtime >= minuptime:
infotext = 'Uptime: %s' % bgp_render_uptime(establishedtime) + infotext
yield Result(state=State.OK, summary='Uptime: %s' % bgp_render_uptime(establishedtime))
else:
yield Result(state=State.WARN, summary='Uptime: %s is less then min. uptime (%s)' % (bgp_render_uptime(establishedtime), bgp_render_uptime(minuptime)))
......@@ -506,7 +505,7 @@ def check_cisco_bgp_peer(item, params, section) -> CheckResult:
#
# disable 'Escape HTML codes in plugin output' in wato --> global settings
#
table_bracket = '<table>%s</table>'
table_bracket = '<table border="1">%s</table>'
line_bracket = '<tr>%s</tr>'
cell_bracket = '<td>%s</td><td>%s</td><td>%s</td>'
cell_seperator = ''
......@@ -514,7 +513,7 @@ def check_cisco_bgp_peer(item, params, section) -> CheckResult:
longoutput = '\n' + table_bracket % (''.join([line_bracket % cell_seperator.join([cell_bracket % (entry[0], entry[1], entry[2])]) for entry in longoutput_data]))
else:
longoutput += '\nfor nicer output' \
'\ndisable \'Escape HTML codes in plugin output\' in wato --> global settings and enable HTML output in \'Parameters for this service\''
'\ndisable \'Escape HTML codes in plugin output\' in wato -> global settings and enable HTML output in \'Parameters for this service\''
for entry in longoutput_data:
if not entry[2] == '':
longoutput += '\n{}: {} / {}'.format(entry[0], entry[1], entry[2])
......@@ -563,15 +562,11 @@ def check_cisco_bgp_peer(item, params, section) -> CheckResult:
except KeyError:
pass
if infotext[0:2] == ', ':
infotext = infotext[2:]
yield Result(state=State.OK, summary=infotext, details=longoutput)
yield Result(state=State.OK, notice=longoutput)
else:
infotext = 'Item not found in SNMP data'
if alias != '':
infotext += ', Alias: %s' % alias
yield Result(state=State(peer_not_found_state), summary=infotext)
yield Result(state=State.OK, summary=', Alias: %s' % alias)
yield Result(state=State(peer_not_found_state), summary='Item not found in SNMP data')
###########################################################################
......
No preview for this file type
......@@ -125,7 +125,7 @@ metric_info['cisco_bgp_peer_inupdateelapsedtime'] = {
#
######################################################################################################################
graph_info['cisco_bgp_peer']={
graph_info['cisco_bgp_peer.prefixes_accepted']={
'title': _('Accepted Prefixes'),
'metrics': [
('cisco_bgp_peer_acceptedprefixes', 'line'),
......@@ -136,7 +136,7 @@ graph_info['cisco_bgp_peer']={
],
}
graph_info['cisco_bgp_peer']={
graph_info['cisco_bgp_peer.prefixes_per_second']={
'title': _('Prefixes/s'),
'metrics': [
('cisco_bgp_peer_deniedprefixes', 'line'),
......@@ -147,7 +147,7 @@ graph_info['cisco_bgp_peer']={
}
graph_info['cisco_bgp_peer']={
graph_info['cisco_bgp_peer.updates_in_out']={
'title': _('Updates'),
'metrics': [
('cisco_bgp_peer_inupdates', 'area'),
......@@ -155,7 +155,7 @@ graph_info['cisco_bgp_peer']={
]
}
graph_info['cisco_bgp_peer']={
graph_info['cisco_bgp_peer.messages_in_out']={
'title': _('Total messages'),
'metrics': [
('cisco_bgp_peer_intotalmessages', 'area'),
......@@ -163,21 +163,21 @@ graph_info['cisco_bgp_peer']={
]
}
graph_info['cisco_bgp_peer']={
graph_info['cisco_bgp_peer.fms_transitions_from_to']={
'title': _('FSM transitions from/to established'),
'metrics': [
('cisco_bgp_peer_fsmestablishedtransitions', 'line'),
],
}
graph_info['cisco_bgp_peer']={
graph_info['cisco_bgp_peer.fms_transitions_last_change']={
'title': _('FSM established last change'),
'metrics': [
('cisco_bgp_peer_fsmestablishedtime', 'line'),
]
}
graph_info['cisco_bgp_peer']={
graph_info['cisco_bgp_peer.time_since_last_update']={
'title': _('Time since last update received'),
'metrics': [
('cisco_bgp_peer_inupdateelapsedtime', 'line'),
......
......@@ -65,15 +65,14 @@ def _parameter_valuespec_cisco_bgp_peer():
('htmloutput',
FixedValue(
True,
help=_(
'render long output of check plugin (multiline) as HTML table. Needs \'Escape HTML codes in plugin output\' in wato --> global settings disabled'),
help=_('render long output of check plugin (multiline) as HTML table. Needs \'Escape HTML codes in plugin output\' in wato --> global settings disabled'),
title=_('enable HTML Output for long output of check plugin (multiline)'),
# label=_('enable'),
totext=_('enable HTML Output for long output of check plugin (multiline)'),
default_value=False,
)),
('infotext_values',
ListChoice(
title=_('Remove values from Infotext'),
# label=_('Remove values from infotext'),
help=_('Select values to remove from check output.'),
choices=cisco_bgp_peer_infotext_values,
default_value=[],
......@@ -81,7 +80,7 @@ def _parameter_valuespec_cisco_bgp_peer():
('peer_list',
ListOf(
Tuple(
title=('BGP Peers'),
# title=('BGP Peers'),
elements=[
TextUnicode(
title=_('BGP Peer item name (without "Cisco BGP peer")'),
......@@ -103,7 +102,7 @@ def _parameter_valuespec_cisco_bgp_peer():
)]),
add_label=_('Add BGP peer'),
movable=False,
title=_(''),
title=_('BGP Peers'),
)),
])
......@@ -114,5 +113,5 @@ rulespec_registry.register(
item_spec=lambda: TextAscii(title=_('BGP peer specific configuration'), ),
match_type='dict',
parameter_valuespec=_parameter_valuespec_cisco_bgp_peer,
title=lambda: _('CCisco BGP peer'),
title=lambda: _('Cisco BGP peer'),
))
\ 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