diff --git a/check_ntp.mkp b/check_ntp.mkp index 5c42ffd374b0a4e095a66ae6427996d87f8f19af..f9ca82dee96d7bc7ebb01aa48cf167f3d2b78873 100644 Binary files a/check_ntp.mkp and b/check_ntp.mkp differ diff --git a/lib/nagios/plugins/check_ntp b/lib/nagios/plugins/check_ntp index f9e6e93b689c9b38ab6c1c540bfb5d68fbbcde52..22c1175b40035d164e733f0c690b78cf4332d1e7 100755 --- a/lib/nagios/plugins/check_ntp +++ b/lib/nagios/plugins/check_ntp @@ -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, diff --git a/web/plugins/wato/active_checks_ntp.py b/web/plugins/wato/active_checks_ntp.py index 42d2184a21fb73e217180f77394c06a5da2a300f..4a52ceba003039f77a9cfae5d652365c43a58b10 100644 --- a/web/plugins/wato/active_checks_ntp.py +++ b/web/plugins/wato/active_checks_ntp.py @@ -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(