Module: check_mk
Branch: master
Commit: 5d6f5ccc344469f003db866ca9b3f947b3bfb432
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5d6f5ccc344469…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Mon Nov 26 15:34:02 2018 +0100
6653 Threshold Levels for steal cpu time in Linux/Unix
Steal CPU time is the percentage of time a virtual CPU waits for a real CPU
while the hypervisor is servicing another virtual processor. Its presense
can be now monitored by setting up threshold limits as a fraction of the
total CPU utilization time.
CMK-1282
Change-Id: Ic075684811867bd040f75f24c008d984c71beb20
---
.werks/6653 | 13 +++++++++++++
checks/cpu_util.include | 3 ++-
cmk/gui/plugins/wato/check_parameters.py | 9 +++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/.werks/6653 b/.werks/6653
new file mode 100644
index 0000000..25a7cc3
--- /dev/null
+++ b/.werks/6653
@@ -0,0 +1,13 @@
+Title: Threshold Levels for steal cpu time in Linux/Unix
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1543244373
+Class: feature
+
+Steal CPU time is the percentage of time a virtual CPU waits for a real CPU
+while the hypervisor is servicing another virtual processor. Its presense
+can be now monitored by setting up threshold limits as a fraction of the
+total CPU utilization time.
diff --git a/checks/cpu_util.include b/checks/cpu_util.include
index 1e6cd10..f9deecd 100644
--- a/checks/cpu_util.include
+++ b/checks/cpu_util.include
@@ -159,7 +159,8 @@ def check_cpu_util_unix(values, params, cores=None):
# where these counters are not being used
steal = diff_values[7]
steal_perc = 100.0 * float(steal) / float(sum_jiffies)
- yield 0, "steal: %.1f%%" % steal_perc, [("steal", steal_perc)]
+ yield check_levels(
+ steal_perc, "steal", params.get('steal'), human_readable_func=get_percent_human_readable)
guest = diff_values[8] + diff_values[9]
guest_perc = 100.0 * float(guest) / float(sum_jiffies)
diff --git a/cmk/gui/plugins/wato/check_parameters.py b/cmk/gui/plugins/wato/check_parameters.py
index 0044b7b..12a07ed 100644
--- a/cmk/gui/plugins/wato/check_parameters.py
+++ b/cmk/gui/plugins/wato/check_parameters.py
@@ -9444,6 +9444,15 @@ register_check_parameters(
"for data coming from or going to disk. If you have a significant disk wait "
"the the bottleneck of your server is IO. Please note that depending on the "
"applications being run this might or might not be totally normal."))),
+ ("steal",
+ Tuple(
+ title=_("Levels on steal CPU utilization"),
+ elements=[
+ Percentage(title=_("Warning at a steal time of"), default_value=30.0),
+ Percentage(title=_("Critical at a steal time of"), default_value=50.0)
+ ],
+ help=_("Here you can set levels on the steal CPU utilization."),
+ )),
] + cpu_util_common_elements),
forth=transform_cpu_iowait,
),
Module: check_mk
Branch: master
Commit: da9ca35d2a2d6b89ef05ac88928be399ff393431
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=da9ca35d2a2d6b…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Mon Nov 19 15:31:10 2018 +0100
6652 Predictive Levels for CPU utilization in Linux/Unix
Linux CPU utilization can now be monitored using predictive levels for the
thresholds to warning and critical states. This confiruration is directly
accessible in WATO.
CKM-1284
Change-Id: Ie6d4cfb55541e3a9ea7794d7e867806d8b080b4f
---
.werks/6652 | 12 +++
checks/kernel | 1 -
cmk/gui/plugins/wato/check_parameters.py | 112 ++++++++++-----------
.../cmk/gui/plugins/wato/test_check_parameters.py | 24 ++++-
4 files changed, 90 insertions(+), 59 deletions(-)
diff --git a/.werks/6652 b/.werks/6652
new file mode 100644
index 0000000..8933212
--- /dev/null
+++ b/.werks/6652
@@ -0,0 +1,12 @@
+Title: Predictive Levels for CPU utilization in Linux/Unix
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1543243736
+Class: feature
+
+Linux CPU utilization can now be monitored using predictive levels for the
+thresholds to warning and critical states. This confiruration is directly
+accessible in WATO.
diff --git a/checks/kernel b/checks/kernel
index 1edc2c0..06ffad7 100644
--- a/checks/kernel
+++ b/checks/kernel
@@ -85,7 +85,6 @@ check_info["kernel"] = {
'group': 'vm_counter',
}
-#.
# .--kernel.util--CPU Utilization----------------------------------------.
# | _ _ _ _ _ _ _ _ |
# | | | | | |_(_) (_)______ _| |_(_) ___ _ __ |
diff --git a/cmk/gui/plugins/wato/check_parameters.py b/cmk/gui/plugins/wato/check_parameters.py
index c416dce..0044b7b 100644
--- a/cmk/gui/plugins/wato/check_parameters.py
+++ b/cmk/gui/plugins/wato/check_parameters.py
@@ -9358,18 +9358,16 @@ cpu_util_common_elements = [
"exceeding a utilization threshold over an extended period of time."
"This is currently only supported on linux and windows agents "
"as well as devices monitored through the host-resource mib"))),
- (
- "core_util_graph",
- Checkbox(
- title=_("Graphs for individual cores"),
- label=_("Enable performance graph for utilization of individual cores"),
- help=_("This adds another graph to the performance CPU utilization "
- "details page, showing utilization of individual cores. "
- "Please note that this graph may be impractical on "
- "device with very many cores. "
- "This is currently only supported on linux and windows agents "
- "as well as devices monitored through the host-resource mib")),
- ),
+ ("core_util_graph",
+ Checkbox(
+ title=_("Graphs for individual cores"),
+ label=_("Enable performance graph for utilization of individual cores"),
+ help=_("This adds another graph to the performance CPU utilization "
+ "details page, showing utilization of individual cores. "
+ "Please note that this graph may be impractical on "
+ "device with very many cores. "
+ "This is currently only supported on linux and windows agents "
+ "as well as devices monitored through the host-resource mib"))),
]
register_check_parameters(
@@ -9392,62 +9390,62 @@ register_check_parameters(
default_value=15,
label=_("Compute average over last "),
)),
- (
- "levels",
- Levels(
- title=_("Levels on total CPU utilization"),
- unit="%",
- default_levels=(85, 90),
- default_difference=(5, 8),
- default_value=None,
- ),
- ),
+ ("levels",
+ Levels(
+ title=_("Levels on total CPU utilization"),
+ unit="%",
+ default_levels=(85, 90),
+ default_difference=(5, 8),
+ default_value=None,
+ )),
] + cpu_util_common_elements,
),
None,
match_type="dict",
)
+
+def transform_cpu_iowait(params):
+ if isinstance(params, tuple):
+ return {"iowait": params}
+
+ return params
+
+
register_check_parameters(
subgroup_os,
"cpu_iowait",
_("CPU utilization on Linux/UNIX"),
Transform(
- Dictionary(
- elements=[
- (
- "iowait",
- Tuple(
- title=_("Levels on disk wait (IO wait)"),
- elements=[
- Percentage(title=_("Warning at a disk wait of"), default_value=30.0),
- Percentage(title=_("Critical at a disk wait of"), default_value=50.0)
- ],
- help=
- _("The CPU utilization sums up the percentages of CPU time that is used "
- "for user processes, kernel routines (system), disk wait (sometimes also "
- "called IO wait) or nothing (idle). "
- "Currently you can only set warning/critical levels to the disk wait. This "
- "is the total percentage of time all CPUs have nothing else to do then waiting "
- "for data coming from or going to disk. If you have a significant disk wait "
- "the the bottleneck of your server is IO. Please note that depending on the "
- "applications being run this might or might not be totally normal.")),
- ),
- ("util",
- Tuple(
- title=_("Levels on total CPU utilization"),
- elements=[
- Percentage(title=_("Warning at a utilization of"), default_value=90.0),
- Percentage(title=_("Critical at a utilization of"), default_value=95.0)
- ],
- help=
- _("Here you can set levels on the total CPU utilization, i.e. the sum of "
- "<i>system</i>, <i>user</i> and <i>iowait</i>. The levels are always applied "
- "on the average utiliazation since the last check - which is usually one minute."
- ),
- )),
- ] + cpu_util_common_elements,),
- forth=lambda old: not isinstance(old, dict) and {"iowait": old} or old,
+ Dictionary(elements=[
+ ("util",
+ Levels(
+ title=_("Levels on total CPU utilization"),
+ unit="%",
+ default_levels=(90, 95),
+ default_difference=(5, 8),
+ default_value=None,
+ help=
+ _("The CPU utilization sums up the percentages of CPU time that is used "
+ "for user processes, kernel routines (system), disk wait (sometimes also "
+ "called IO wait) or nothing (idle). The levels are always applied "
+ "on the average utiliazation since the last check - which is usually one minute."
+ ),
+ )),
+ ("iowait",
+ Tuple(
+ title=_("Levels on disk wait (IO wait)"),
+ elements=[
+ Percentage(title=_("Warning at a disk wait of"), default_value=30.0),
+ Percentage(title=_("Critical at a disk wait of"), default_value=50.0)
+ ],
+ help=
+ _("The disk wait is the total percentage of time all CPUs have nothing else to do but waiting "
+ "for data coming from or going to disk. If you have a significant disk wait "
+ "the the bottleneck of your server is IO. Please note that depending on the "
+ "applications being run this might or might not be totally normal."))),
+ ] + cpu_util_common_elements),
+ forth=transform_cpu_iowait,
),
None,
"dict",
diff --git a/tests/unit/cmk/gui/plugins/wato/test_check_parameters.py b/tests/unit/cmk/gui/plugins/wato/test_check_parameters.py
index afe72e3..e4f666c 100644
--- a/tests/unit/cmk/gui/plugins/wato/test_check_parameters.py
+++ b/tests/unit/cmk/gui/plugins/wato/test_check_parameters.py
@@ -1,6 +1,7 @@
import pytest
from cmk.gui.exceptions import MKUserError
-from cmk.gui.plugins.wato.check_parameters import forbid_re_delimiters_inside_groups
+from cmk.gui.plugins.wato.check_parameters import (forbid_re_delimiters_inside_groups,
+ transform_cpu_iowait)
@pytest.mark.parametrize('pattern', ["(test)$", 'foo\\b', '^bar', '\\bfoo\\b', '(a)\\b'])
@@ -12,3 +13,24 @@ def test_validate_ps_allowed_regex(pattern):
def test_validate_ps_forbidden_regex(pattern):
with pytest.raises(MKUserError):
forbid_re_delimiters_inside_groups(pattern, '')
+
+
+(a)pytest.mark.parametrize('params, result', [
+ (
+ (10, 20),
+ {
+ 'iowait': (10, 20)
+ },
+ ),
+ ({}, {}),
+ (
+ {
+ 'util': (50, 60)
+ },
+ {
+ 'util': (50, 60)
+ },
+ ),
+])
+def test_transform_cpu_iowait(params, result):
+ assert transform_cpu_iowait(params) == result
Module: check_mk
Branch: master
Commit: 7bd0362b5d01852ecdf0cb40aa4f0f08503a8046
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7bd0362b5d0185…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 15 22:43:05 2018 +0100
Dynamic configuration: Add distributed WATO support
In distributed WATO setups there is only one site where changes to the
Check_MK configuration can be made. This is the central site. However,
there are a lot of situations where the source for the dynamic
configuration, e.g. a Kubernetes instance, is only reachable from a remote
Check_MK site.
This means that we need to split up the DCD connection logic into two
phases.
In phase 1 the connection on the remote site talks to the source system,
e.g. the Kubernetes instance, and creates some kind of "configuration
snapshot". This information may be a collection of Pods, containers and
so on which will be used to update the Check_MK configuration in the
next step.
The DCD on the central site is communicating with the DCD on the remote
site to get the latest "configuration snapshot". With this knowledge the
phase 2 is launched. In this phase the connection is comparing the phase
1 information with data fetched from the Web API of the central WATO
site and deciding to create, update or delete objects in the Check_MK
configuration. These updates are made immediately to the configuration
and activated once it's allowed.
* The DCD now knows whether or not it's running in a distributed WATO
remote site
* Split connection execute() into two phases
* Moved phase execution logic to the Connector() base class
* Improved test coverage
CMK-1140
Change-Id: I51e7f0dc1e9df7e9c8c25a0598c3cf94292666ed
---
cmk/gui/plugins/wato/__init__.py | 1 +
cmk/gui/plugins/wato/utils/__init__.py | 1 +
cmk/gui/watolib.py | 4 ++--
tests/unit/cmk/gui/test_watolib.py | 1 +
4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/cmk/gui/plugins/wato/__init__.py b/cmk/gui/plugins/wato/__init__.py
index fae2a3e..c7f150a 100644
--- a/cmk/gui/plugins/wato/__init__.py
+++ b/cmk/gui/plugins/wato/__init__.py
@@ -106,6 +106,7 @@ from cmk.gui.plugins.wato.utils import (
WatoBackgroundJob,
wato_confirm,
wato_fileheader,
+ register_hook,
WatoMode,
SimpleModeType,
SimpleListMode,
diff --git a/cmk/gui/plugins/wato/utils/__init__.py b/cmk/gui/plugins/wato/utils/__init__.py
index 8a5c47b..0352822 100644
--- a/cmk/gui/plugins/wato/utils/__init__.py
+++ b/cmk/gui/plugins/wato/utils/__init__.py
@@ -99,6 +99,7 @@ from cmk.gui.watolib import (
add_change,
log_audit,
site_neutral_path,
+ register_hook,
register_rulegroup,
register_rule,
declare_host_attribute,
diff --git a/cmk/gui/watolib.py b/cmk/gui/watolib.py
index 021f87f..d75909c 100644
--- a/cmk/gui/watolib.py
+++ b/cmk/gui/watolib.py
@@ -99,7 +99,7 @@ import cmk.gui.gui_background_job as gui_background_job
import cmk.gui.weblib as weblib
from cmk.gui.i18n import _u, _
from cmk.gui.globals import html
-from cmk.gui.htmllib import HTML
+from cmk.gui.htmllib import HTML, Encoder
from cmk.gui.log import logger
from cmk.gui.exceptions import MKGeneralException, MKAuthException, MKUserError, RequestTimeout
from cmk.gui.valuespec import (
@@ -4661,7 +4661,7 @@ def do_remote_automation(site, command, vars_):
raise MKAutomationException(_("You are not logged into the remote site."))
url = base_url + "automation.py?" + \
- html.urlencode_vars([
+ Encoder().urlencode_vars([
("command", command),
("secret", secret),
("debug", config.debug and '1' or '')
diff --git a/tests/unit/cmk/gui/test_watolib.py b/tests/unit/cmk/gui/test_watolib.py
index cb8a97f..3579145 100644
--- a/tests/unit/cmk/gui/test_watolib.py
+++ b/tests/unit/cmk/gui/test_watolib.py
@@ -61,6 +61,7 @@ def test_registered_automation_commands():
assert registered == sorted([
'activate-changes',
'check-analyze-config',
+ 'execute-dcd-command',
'network-scan',
'push-snapshot',
])
Module: check_mk
Branch: master
Commit: 5f747a2774c73e966d89724510d5eb2b0cdc1689
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5f747a2774c73e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 14 17:42:49 2018 +0100
Dynamic configuration: Add command server and client
* The CommandManager is listening locally on tmp/run/dcd.sock
for external queries / commands to the DCD.
* The API is only available to the local site in the first place.
* This API will be contacted from the local WATO instance to serve
status information and, in distributed setups, for replication from
remote sites to the central WATO site.
* For the moment we use the standard xmlrpc library for the API. This
will be replaced with our new standard HTTP API stuff once that is
ready.
* Enabled mypy to scan the dcd files.
CMK-1140
Change-Id: If6bb79747a2ca1c88f7d9ee7e1a1288a2015595a
---
tests/static/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/static/Makefile b/tests/static/Makefile
index 90e4577..c74e556 100644
--- a/tests/static/Makefile
+++ b/tests/static/Makefile
@@ -1,4 +1,6 @@
FILES_TO_CHECK := $(realpath $(addprefix ../../cmk/ec/,defaults.py export.py main.py settings.py)) \
+ $(realpath $(addprefix ../../cmk/cee/dcd/,main.py Config.py Manager.py CommandManager.py)) \
+ $(realpath $(addprefix ../../cmk/cee/dcd/connectors,piggyback.py utils.py)) \
$(realpath $(addprefix ../../cmk/,daemon.py i18n.py paths.py regex.py render.py structured_data.py)) \
$(realpath $(addprefix ../../cmk/gui/,dashboard.py exceptions.py globals.py htmllib.py http_status.py \
i18n.py sidebar.py sites.py table.py visuals.py)) \
Module: check_mk
Branch: master
Commit: 32ffe59246283df2401b65d540e54bdee2103e80
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=32ffe59246283d…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Nov 26 14:18:52 2018 +0100
Unbreak google.auth import.
Change-Id: Iab1722fa0943e540d4c8b08e221f971e3c614f67
---
omd/packages/Python/sitecustomize.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/omd/packages/Python/sitecustomize.py b/omd/packages/Python/sitecustomize.py
index 6a6e6d6..7a50788 100644
--- a/omd/packages/Python/sitecustomize.py
+++ b/omd/packages/Python/sitecustomize.py
@@ -1,12 +1,16 @@
#!/usr/bin/env python
# Make the site python know about the Check_MK specific python module paths
-import sys, os
+import os
+import site
+import sys
-# Set the Check_MK version specific python module directory. This is
-# the location for the extra python modules shipped with Check_MK.
+# Set the Check_MK version specific python module directory. This is the
+# location for the extra python modules shipped with Check_MK.
+# NOTE: Modifying sys.path alone is not enough, site.addsitedir makes sure that
+# path configuration files (*.pth) are actually found!
version_path = os.path.dirname(os.path.dirname(sys.executable))
-sys.path.insert(0, version_path + "/lib/python")
+site.addsitedir(version_path + "/lib/python")
# Regular use case: When "omd" is being executed as root, we don't know
# anything about the site -> Only set the version specific directory.