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

Delete active_checks_routing.py

parent 6413b1ab
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# License: GNU General Public License v2
#
# original form lib/check_mk/gui/plugins/wato/active_checks.py
#
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2021-12-03
#
# added: description, method UDP, port, destination_address, queries, max_ttl, source_interface, source_address
#
from cmk.gui.i18n import _
from cmk.gui.valuespec import (
Dictionary,
ListOf,
Tuple,
Transform,
Checkbox,
DropdownChoice,
TextInput,
Integer,
TextAscii,
)
from cmk.gui.plugins.wato import (
rulespec_registry,
HostRulespec,
)
from cmk.gui.plugins.wato.active_checks import (
RulespecGroupActiveChecks
)
def _ip_address_family_element():
return (
'address_family',
DropdownChoice(
title=_('IP address family'),
choices=[
(None, _('Primary address family')),
('ipv4', _('Enforce IPv4')),
('ipv6', _('Enforce IPv6')),
],
default_value=None,
),
)
def _transform_add_address_family(v):
v.setdefault('address_family', None)
return v
def _valuespec_active_checks_traceroute():
return Transform(
Dictionary(
title=_('Check current routing'),
help=_(
'This active check uses <tt>traceroute</tt> in order to determine the current '
'routing from the monitoring host to the target host. You can specify any number '
'of missing or expected routes in order to detect e.g. an (unintended) failover '
'to a secondary route.'
),
elements=[
('description',
TextAscii(
title=_('Service Description suffix'),
help=_('Must be unique for every host. The service description starts always with \"Routing\".'),
size=30,
)),
('dns',
Checkbox(
title=_('Name resolution'),
label=_('Use DNS to convert IP addresses into hostnames'),
help=_(
'If you use this option, then <tt>traceroute</tt> is <b>not</b> being '
'called with the option <tt>-n</tt>. That means that all IP addresses '
'are tried to be converted into names. This usually adds additional '
'execution time. Also DNS resolution might fail for some addresses.'
),
),),
_ip_address_family_element(),
('routers',
ListOf(
Tuple(
elements=[
TextInput(
title=_('Router (FQDN, IP-Address)'),
allow_empty=False,
),
DropdownChoice(
title=_('How'),
choices=[
('W', _('WARN - if this router is not being used')),
('C', _('CRIT - if this router is not being used')),
('w', _('WARN - if this router is being used')),
('c', _('CRIT - if this router is being used')),
],
),
]
),
title=_('Router that must or must not be used'),
add_label=_('Add Condition'),
),),
('method',
DropdownChoice(
title=_('Method of probing'),
choices=[
(None, _('UDP lite (default behaviour of traceroute)')),
('udp', _('UDP (without increasing the port for each probe)')),
('icmp', _('ICMP Echo Request')),
('tcp', _('TCP SYN, needs root permissions')),
],
default_value='icmp',
),),
('port',
Integer(
title=_('Port'),
help=_('Set the destination port to use. It is either initial udp port value for \"default\" '
'method (incremented by each probe, default is 33434), or initial seq for \"icmp\" '
'(incremented as well, default from 1), or some constant destination port for other '
'methods (with default of 80 for \"tcp\", 53 for \"udp\", etc.)'),
maxvalue=65535,
default_value=53,
),),
('destination_address',
TextAscii(
title=_('Alternate Destination'),
help=_('Path trace to alternate destination instead of \"HOSTADDRESS\".'),
),),
('queries',
Integer(
title=_('Number of queries'),
help=_('Set the number of probes per each hop. Default is 3.'),
default_value=3,
minvalue=1,
maxvalue=10,
),),
('max_ttl',
Integer(
title=_('Max hops'),
help=_('Set the max number of hops (max TTL to be reached). Default is 30'),
default_value=30,
minvalue=1,
maxvalue=255,
),),
('source_interface',
TextAscii(
title=_('Source interface'),
help=_('Specify a network interface to operate with. Needs root permissions.'),
),),
('source_address',
TextAscii(
title=_('Source address'),
help=_('Use source source address for outgoing packets'),
),),
],
optional_keys=['description', 'max_ttl', 'queries', 'destination_address', 'source_address',
'source_interface', 'port'],
),
forth=_transform_add_address_family,
)
rulespec_registry.register(
HostRulespec(
group=RulespecGroupActiveChecks,
match_type='all',
name='active_checks:traceroute',
valuespec=_valuespec_active_checks_traceroute,
)
)
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