Module: check_mk
Branch: master
Commit: 4fe5cad19fe28d84dc6c744ae1f141aed26d0db5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4fe5cad19fe28d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Apr 19 12:27:16 2018 +0200
5988 docker_container_diskstat: Check disk usage of docker containers
Change-Id: I3fe1d5bf03fbe8760e3eeea7d73e6cd6a62bee92
---
.werks/5988 | 11 +++
agents/check_mk_agent.linux | 7 ++
checkman/docker_container_diskstat | 20 ++++++
checks/docker_container_diskstat | 136 +++++++++++++++++++++++++++++++++++++
4 files changed, 174 insertions(+)
diff --git a/.werks/5988 b/.werks/5988
new file mode 100644
index 0000000..5f41f30
--- /dev/null
+++ b/.werks/5988
@@ -0,0 +1,11 @@
+Title: docker_container_diskstat: Check disk usage of docker containers
+Level: 1
+Component: checks
+Class: feature
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1524133606
+
+
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index c4fbf40..b172403 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -489,10 +489,17 @@ if [ -z "$MK_IN_CONTAINER" ]; then
fi
else
echo '<<<docker_container_diskstat>>>'
+ echo "[time]"
+ date +%s
for F in io_service_bytes io_serviced; do
echo "[$F]"
cat "/sys/fs/cgroup/blkio/blkio.throttle.$F"
done
+ echo "[names]"
+ for F in /sys/block/*; do
+ echo -n "${F##*/} " ;
+ cat "$F/dev";
+ done
fi
diff --git a/checkman/docker_container_diskstat b/checkman/docker_container_diskstat
new file mode 100644
index 0000000..6df80a0
--- /dev/null
+++ b/checkman/docker_container_diskstat
@@ -0,0 +1,20 @@
+title: Docker container disk throughput
+agents: linux
+catalog: app/docker
+license: GPL
+distribution: check_mk
+description:
+ This check measures the throughput of block devices (disks) of docker
+ containers. You can either have a single check for every single disk or a
+ summary check (which is the default) summing up the throughput of all disks.
+
+ This check measures the memory usage of a docker container respecting
+ either the memory limits of the docker node or the limit configured
+ for the container.
+
+ Use the "Main memory usage (UNIX / Other Devices)" rule set to configure
+ thresholds on the memory usage.
+
+item:
+ Either {"SUMMARY"} for a summarized check of all disks or the name of the
+ disk device, e.g. {"sda"}.
diff --git a/checks/docker_container_diskstat b/checks/docker_container_diskstat
new file mode 100644
index 0000000..695ea2c
--- /dev/null
+++ b/checks/docker_container_diskstat
@@ -0,0 +1,136 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# tails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+def parse_docker_container_diskstat(info):
+ node_sections = _parse_sub_sections(info)
+
+ disks = {}
+ for node_name, node_info in node_sections.items():
+ timestamp = node_info["time"]
+
+ for device_id, device in node_info["devices"].items():
+ # Filter out unwanted things
+ if device["name"].startswith("loop"):
+ continue
+
+ # Skip devices without counts
+ if "ios" not in device or "bytes" not in device:
+ continue
+
+ disks[(node_name, device["name"])] = timestamp, device
+
+ return disks
+
+
+def _parse_sub_sections(info):
+ node_sections = {}
+
+ node = None
+ for line in info:
+ node = line[0]
+
+ if line[1] == "[io_service_bytes]":
+ phase = "bytes"
+ elif line[1] == "[io_serviced]":
+ phase = "ios"
+ elif line[1] == '[names]':
+ phase = "names"
+ elif line[1] == '[time]':
+ phase = "time"
+ else:
+ if line[1] == "Total":
+ continue
+
+ sections = node_sections.setdefault(node, {})
+
+ if phase == "time":
+ sections["time"] = int(line[1])
+ continue
+
+ devices = sections.setdefault("devices", {})
+
+ if phase == "names":
+ major, minor = map(int, line[2].split(":"))
+ else:
+ major, minor = map(int, line[1].split(":"))
+
+ device_id = node, major, minor
+ device = devices.setdefault(device_id, {})
+
+ if phase == "names":
+ device["name"] = line[1]
+ else:
+ device_phase = device.setdefault(phase, {})
+ device_phase[line[2]] = int(line[3])
+
+ return node_sections
+
+
+def inventory_docker_container_diskstat(parsed):
+ return inventory_diskstat_generic(parsed.keys())
+
+
+def check_docker_container_diskstat(item, params, parsed):
+ disks = {}
+ for (node_name, device_name), (timestamp, device) in parsed.items():
+ counter_base = "diskstat.%s." % device_name
+
+ # Docker container information is provided via piggyback in the most cases. In case
+ # we got no new data simply skip this check
+ previous_timestamp = get_item_state(counter_base + "time")
+ if previous_timestamp == timestamp:
+ raise MKCounterWrapped('No time difference')
+ set_item_state(counter_base + "time", timestamp)
+
+ read_ios_rate = get_rate(counter_base + "read_ios", timestamp, device["ios"]["Read"], onwrap=0.0)
+ write_ios_rate = get_rate(counter_base + "write_ios", timestamp, device["ios"]["Write"], onwrap=0.0)
+ total_ios_rate = read_ios_rate + write_ios_rate
+ read_bytes_rate = get_rate(counter_base + "read_bytes", timestamp, device["bytes"]["Read"], onwrap=0.0)
+ write_bytes_rate = get_rate(counter_base + "write_bytes", timestamp, device["bytes"]["Write"], onwrap=0.0)
+ total_bytes_rate = read_bytes_rate + write_bytes_rate
+
+ disks[device_name] = {
+ "node" : node_name,
+ "read_ios" : read_ios_rate,
+ "write_ios" : write_ios_rate,
+ "read_throughput" : read_bytes_rate,
+ "write_throughput" : write_bytes_rate,
+ }
+
+ return check_diskstat_dict(item, params, disks)
+
+
+check_info["docker_container_diskstat"] = {
+ "parse_function" : parse_docker_container_diskstat,
+ "inventory_function" : inventory_docker_container_diskstat,
+ "check_function" : check_docker_container_diskstat,
+ "service_description" : "Disk IO %s",
+ "has_perfdata" : True,
+ "group" : "diskstat",
+ "node_info" : True, # add first column with actual host name
+ "includes" : [ "diskstat.include" ],
+}
+
Module: check_mk
Branch: master
Commit: ead9c0f065f4610b8cbd34ed660be6c01c70d43d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ead9c0f065f461…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Thu Apr 19 09:05:25 2018 +0200
Win-agent: ensure regeneration of gcov coverage
Clean old gcda files as gcov does not guarantee to overwrite them.
This is relevant at least when we only change tests but not the source
under testing: otherwise gcov may not reproduce the coverage correctly
after the changes.
---
agents/windows/Makefile.am | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/agents/windows/Makefile.am b/agents/windows/Makefile.am
index 7af9563..7547084 100644
--- a/agents/windows/Makefile.am
+++ b/agents/windows/Makefile.am
@@ -65,7 +65,11 @@ integrationtest: install-strip
fi ; \
cd -
-coverage.info: WindowsAgentCoverage$(EXEEXT)
+# Force regeneration of coverage data during test run.
+clean-coverage:
+ rm -f $$(find . -name "*.gcda")
+
+coverage.info: WindowsAgentCoverage$(EXEEXT) clean-coverage
DISPLAY="$$DISPLAY xterm" wine $< 2>/dev/null ; \
lcov -c --rc lcov_branch_coverage=1 --directory . -o $@
Module: check_mk
Branch: master
Commit: 5012cd62d45d4dd9b64459cc8c070b482be90f4e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5012cd62d45d4d…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Apr 18 16:55:17 2018 +0200
5801 FIX Fixed incorrect check parameter assignment after tabula rasa
The tabula rasa discovery could assign incorrect default parameters to the discovered service.
Generally, if multiple rules provide check parameters, the most specific rule should win.
For ps checks the least specific rule did win. This has been fixed.
Change-Id: Id945afe730b6d3b9104945655fbf55e988f6452c
---
.werks/5801 | 13 +++++++++++++
cmk_base/discovery.py | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/5801 b/.werks/5801
new file mode 100644
index 0000000..430e810
--- /dev/null
+++ b/.werks/5801
@@ -0,0 +1,13 @@
+Title: Fixed incorrect check parameter assignment after tabula rasa
+Level: 1
+Component: checks
+Class: fix
+Compatible: incomp
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1524062928
+
+The tabula rasa discovery could assign incorrect default parameters to the discovered service.
+Generally, if multiple rules provide check parameters, the most specific rule should win.
+For ps checks the least specific rule did win. This has been fixed.
diff --git a/cmk_base/discovery.py b/cmk_base/discovery.py
index 882849a..fcaf2a9 100644
--- a/cmk_base/discovery.py
+++ b/cmk_base/discovery.py
@@ -979,7 +979,7 @@ def _get_discovered_services(hostname, ipaddress, sources, multi_host_sections,
# Handle discovered services -> "new"
new_items = _discover_services(hostname, ipaddress, sources, multi_host_sections, on_error)
for check_plugin_name, item, paramstring in new_items:
- services[(check_plugin_name, item)] = ("new", paramstring)
+ services.setdefault((check_plugin_name, item), ("new", paramstring))
# Match with existing items -> "old" and "vanished"
old_items = parse_autochecks_file(hostname)
Module: check_mk
Branch: master
Commit: e7c400ffd51c6a33974a1671379ccedb9c25c53d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e7c400ffd51c6a…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Apr 18 14:54:00 2018 +0200
Removed useless Transform.
Change-Id: I555070748cc80fbefe706a0d3f66919adcfafe6b
---
web/plugins/wato/mkeventd.py | 44 +++++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/web/plugins/wato/mkeventd.py b/web/plugins/wato/mkeventd.py
index 67c7cc3..f080a75 100644
--- a/web/plugins/wato/mkeventd.py
+++ b/web/plugins/wato/mkeventd.py
@@ -351,29 +351,27 @@ def vs_mkeventd_rule(customer=None):
help = _("The monitoring state that this event will trigger."),
default_value = -1,
)),
- ( "sl", Transform(
- Dictionary(
- title = _("Service Level"),
- optional_keys = False,
- elements = [
- ( "value", DropdownChoice(
- title = _("Value"),
- choices = mkeventd.service_levels,
- prefix_values = True,
- help = _("The default/fixed service level to use for this rule."),
- )),
- ( "precedence", DropdownChoice(
- title = _("Precedence"),
- choices = [
- ( "message", _("Keep service level from message (if available)") ),
- ( "rule", _("Always use service level from rule") ),
- ],
- help = _("Here you can specify which service level will be used when "
- "the incoming message already carries a service level."),
- default_value = "message",
- )),
- ]
- )
+ ( "sl", Dictionary(
+ title = _("Service Level"),
+ optional_keys = False,
+ elements = [
+ ( "value", DropdownChoice(
+ title = _("Value"),
+ choices = mkeventd.service_levels,
+ prefix_values = True,
+ help = _("The default/fixed service level to use for this rule."),
+ )),
+ ( "precedence", DropdownChoice(
+ title = _("Precedence"),
+ choices = [
+ ( "message", _("Keep service level from message (if available)") ),
+ ( "rule", _("Always use service level from rule") ),
+ ],
+ help = _("Here you can specify which service level will be used when "
+ "the incoming message already carries a service level."),
+ default_value = "message",
+ )),
+ ]
)),
( "contact_groups", Dictionary(
title = _("Contact Groups"),
Module: check_mk
Branch: master
Commit: 801372145fbc3001fa51d224ce1991c62349c79d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=801372145fbc30…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Apr 18 14:52:43 2018 +0200
5800 FIX Availability: UNMONITORED timeperiods were incorrectly used in computation results in certain scenarios
When honoring host and service periods, UNMONITORED timeperiods outside of a service period were will still used in the computation.
Change-Id: I329be6e96ec0de920954b512ef9e64d863a68879
---
.werks/5800 | 10 ++++++++++
web/htdocs/availability.py | 12 +++++-------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/.werks/5800 b/.werks/5800
new file mode 100644
index 0000000..e4f3a39
--- /dev/null
+++ b/.werks/5800
@@ -0,0 +1,10 @@
+Title: Availability: UNMONITORED timeperiods were incorrectly used in computation results in certain scenarios
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1524055633
+Class: fix
+
+When honoring host and service periods, UNMONITORED timeperiods outside of a service period were will still used in the computation.
diff --git a/web/htdocs/availability.py b/web/htdocs/availability.py
index b9ffaaf..ad4cdf3 100644
--- a/web/htdocs/availability.py
+++ b/web/htdocs/availability.py
@@ -820,18 +820,16 @@ def compute_availability(what, av_rawdata, avoptions):
host_alias = span.get("host_alias", site_host[1])
consider = True
- if state == -1:
- s = "unmonitored"
- if not avoptions["consider"]["unmonitored"]:
- consider = False
-
- elif avoptions["service_period"] != "ignore" and \
+ if avoptions["service_period"] != "ignore" and \
(( span["in_service_period"] and avoptions["service_period"] != "honor" )
or \
( not span["in_service_period"] and avoptions["service_period"] == "honor" )):
s = "outof_service_period"
consider = False
-
+ elif state == -1:
+ s = "unmonitored"
+ if not avoptions["consider"]["unmonitored"]:
+ consider = False
elif span["in_notification_period"] == 0 and avoptions["notification_period"] == "exclude":
consider = False
Module: check_mk
Branch: master
Commit: 0a4b8bd43d2876ff20dabaab85bb12fac9d54ca3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0a4b8bd43d2876…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Apr 18 13:35:23 2018 +0200
updated werk text
Change-Id: I994cc384569c307ceb886a42a01e4a15c242d0a4
---
.werks/5799 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.werks/5799 b/.werks/5799
index 57a22fe..f14b8f8 100644
--- a/.werks/5799
+++ b/.werks/5799
@@ -7,7 +7,7 @@ Version: 1.6.0i1
Date: 1524050943
Class: fix
-This error appears when the availability timeline is not fully connect, e.g. if it is split
+This error appears when the availability timeline is not fully connected, e.g. if it is split
by a service period. The computation error itself seems no big issue, since this incorrect
computed value wasn't evaluated, anyway.