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

update project

parent 1b9c250f
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -111,7 +111,7 @@ def _ntp_decode_ref_id(stratum: int, ref_id: int):
if 1 < stratum < 16:
return IPv4Address(ref_id)
elif 0 <= stratum <= 1:
elif stratum in [0, 1]:
_byte4 = ref_id % 256
_byte3 = (ref_id // 256) % 256
_byte2 = (ref_id // 256 // 256) % 256
......@@ -125,7 +125,7 @@ def _ntp_decode_ref_id(stratum: int, ref_id: int):
return ref_id
def parse_arguments(argv: Sequence[str]): # -> argparse.Namespace # is not available if ntplib is not installed
def parse_arguments(argv: Sequence[str]) -> argparse.Namespace:
def _warn_crit(arg: str) -> Optional[Tuple[int, int]]:
arg = arg.strip('(').strip(')').split(',')
warn, crit = arg
......@@ -175,14 +175,7 @@ def parse_arguments(argv: Sequence[str]): # -> argparse.Namespace # is not ava
return args
def output_check_result(s, perfdata):
if perfdata:
perfdata_output_entries = ['%s=%s' % (p[0], ';'.join(map(str, p[1:]))) for p in perfdata]
s += ' | %s' % ' '.join(perfdata_output_entries)
sys.stdout.write('%s\n' % s)
def get_ntp_time(server: str, port: int, timeout: int, version: int) -> Optional[NTPStats]:
def get_ntp_time(server: str, port: int, timeout: int, version: int): # -> Optional[NTPStats] # is not available if ntplib is not installed
c = NTPClient()
response = c.request(
host=server,
......
......@@ -13,12 +13,8 @@
from cmk.gui.i18n import _
from cmk.gui.valuespec import (
Dictionary,
ListOf,
Tuple,
Transform,
Checkbox,
DropdownChoice,
TextInput,
Integer,
TextAscii,
MonitoringState,
......@@ -42,7 +38,7 @@ def _valuespec_active_checks_ntp():
elements=[
('description',
TextAscii(
title=_('Service Description suffix'),
title=_('Service description'),
help=_(
'Must be unique for every host. The service description starts always with \"NTP server\".'),
size=50,
......@@ -75,7 +71,7 @@ def _valuespec_active_checks_ntp():
)),
('version',
Integer(
title=_('Version'),
title=_('NTP version'),
help=_('NTP version for the request. Default is version 4.'),
# size=1,
default_value=4,
......@@ -90,7 +86,7 @@ def _valuespec_active_checks_ntp():
)),
('stratum_levels',
Tuple(
title=_('max. Stratum'),
title=_('max. stratum'),
elements=[
Integer(
title=_('Warning at'),
......@@ -150,7 +146,7 @@ def _valuespec_active_checks_ntp():
)),
('dispersion_levels',
Tuple(
title=_('max. Dispersion in s'),
title=_('max. root dispersion in s'),
help=_('Upper levels for (root) dispersion in seconds.'),
elements=[
Integer(
......
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