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