Module: check_mk
Branch: master
Commit: 2fd617ebc918bcf2531b9bea3ac0256f27bb8348
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2fd617ebc918bc…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Apr 17 11:43:59 2018 +0200
5837 FIX Fixed overflow event text for local limits.
The event text of overflow events always contained the global limit, even
when the reason for the overflow event was a local limit. This has been
fixed.
Change-Id: Ic35b739560a970a394702655f14ab8cba99d40bb
---
.werks/5837 | 12 ++++++++++++
cmk/ec/main.py | 10 +++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/.werks/5837 b/.werks/5837
new file mode 100644
index 0000000..aa0a9e5
--- /dev/null
+++ b/.werks/5837
@@ -0,0 +1,12 @@
+Title: Fixed overflow event text for local limits.
+Level: 1
+Component: ec
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1523958152
+Class: fix
+
+The event text of overflow events always contained the global limit, even
+when the reason for the overflow event was a local limit. This has been
+fixed.
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index 7bc7013..0b4e0a1 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -3010,7 +3010,7 @@ class EventServer(ECServerThread):
# events will be stopped.
# Perform one time actions
- overflow_event = self._create_overflow_event(ty, event)
+ overflow_event = self._create_overflow_event(ty, event, limit)
if "overflow" in action:
self.logger.info(" Creating overflow event")
@@ -3043,7 +3043,7 @@ class EventServer(ECServerThread):
return limit, action
- def _create_overflow_event(self, ty, event):
+ def _create_overflow_event(self, ty, event, limit):
now = time.time()
new_event = {
"rule_id": None,
@@ -3072,7 +3072,7 @@ class EventServer(ECServerThread):
new_event["text"] = (
"The overall event limit of %d open events has been reached. Not "
"opening any additional event until open events have been "
- "archived." % self._config["event_limit"]["overall"]["limit"]
+ "archived." % limit
)
elif ty == "by_host":
@@ -3082,7 +3082,7 @@ class EventServer(ECServerThread):
"text": (
"The host event limit of %d open events has been reached for host \"%s\". "
"Not opening any additional event for this host until open events have "
- "been archived." % (self._config["event_limit"]["by_host"]["limit"], event["host"])
+ "been archived." % (limit, event["host"])
)
})
@@ -3100,7 +3100,7 @@ class EventServer(ECServerThread):
"The rule event limit of %d open events has been reached for rule \"%s\". "
"Not opening any additional event for this rule until open events have "
"been archived." %
- (self._config["event_limit"]["by_rule"]["limit"], event["rule_id"])
+ (limit, event["rule_id"])
)
})
Module: check_mk
Branch: master
Commit: 45d6c87c5f07bf34204f1351f65958099b19157c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=45d6c87c5f07bf…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Wed Apr 11 17:42:48 2018 +0200
5913 FIX webapi: Fixed handling of the option mode in service discovery
The previous implementation of the option "mode" in service_discovery did not
allow a handling in the same way as in other webapi requests like including it
into the request part. This is now fixed. The old behaviour is still supported.
old only supported this syntax:
curl "http://localhost/$OMD_SITE/check_mk/webapi.py?action=discover_services&_use… $OMD_ROOT/var/check_mk/web/automation/automation.secret)&mode=refresh" -d 'request={"hostname":"heute"}'
newly supported and now coherent to other calls:
curl "http://localhost/$OMD_SITE/check_mk/webapi.py?action=discover_services&_use… $OMD_ROOT/var/check_mk/web/automation/automation.secret)" -d 'request={"hostname":"heute", "mode":"refresh"}'
Change-Id: I194855bdd752a0e236d5839a3b786a426b401bd1
---
.werks/5913 | 18 ++++++++++++++++++
web/plugins/webapi/webapi.py | 4 ++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/.werks/5913 b/.werks/5913
new file mode 100644
index 0000000..bc665ef
--- /dev/null
+++ b/.werks/5913
@@ -0,0 +1,18 @@
+Title: webapi: Fixed handling of the option mode in service discovery
+Level: 1
+Component: wato
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1523461091
+Class: fix
+
+The previous implementation of the option "mode" in service_discovery did not
+allow a handling in the same way as in other webapi requests like including it
+into the request part. This is now fixed. The old behaviour is still supported.
+
+old only supported this syntax:
+curl "http://localhost/$OMD_SITE/check_mk/webapi.py?action=discover_services&_use… $OMD_ROOT/var/check_mk/web/automation/automation.secret)&mode=refresh" -d 'request={"hostname":"heute"}'
+
+newly supported and now coherent to other calls:
+curl "http://localhost/$OMD_SITE/check_mk/webapi.py?action=discover_services&_use… $OMD_ROOT/var/check_mk/web/automation/automation.secret)" -d 'request={"hostname":"heute", "mode":"refresh"}'
diff --git a/web/plugins/webapi/webapi.py b/web/plugins/webapi/webapi.py
index 7f52dfe..b2a41f1 100644
--- a/web/plugins/webapi/webapi.py
+++ b/web/plugins/webapi/webapi.py
@@ -1017,7 +1017,7 @@ def action_discover_services(request):
validate_request_keys(request, required_keys=["hostname"],
optional_keys=["mode"])
- mode = html.var("mode", deflt="new")
+ mode = request.get("mode", "new")
hostname = request.get("hostname")
check_hostname(hostname, should_exist = True)
@@ -1055,7 +1055,7 @@ api_actions["discover_services"] = {
def action_activate_changes(request):
validate_request_keys(request, optional_keys=["mode", "sites", "allow_foreign_changes", "comment"])
- mode = html.var("mode", deflt="dirty")
+ mode = request.get("mode", "dirty")
if request.get("allow_foreign_changes"):
allow_foreign_changes = bool(int(request.get("allow_foreign_changes")))
else:
Module: check_mk
Branch: master
Commit: 961d1066637dcedfa281597dfa5b3daa7560dc79
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=961d1066637dce…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 16 16:56:39 2018 +0200
5981 FIX Fixed displaying of BI aggregation with icons
When displaying BI aggregations that want to display an icon,
for example when a service is in downtime, an exception like
this could occur: TypeError: render_icon() got an unexpected keyword argument 'class_'.
Change-Id: I0ccb600d9c664b696b67308293631a6479bbd097
---
.werks/5981 | 13 +++++++++++++
web/htdocs/htmllib.py | 5 ++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/5981 b/.werks/5981
new file mode 100644
index 0000000..272ab2b
--- /dev/null
+++ b/.werks/5981
@@ -0,0 +1,13 @@
+Title: Fixed displaying of BI aggregation with icons
+Level: 1
+Component: bi
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1523890523
+
+When displaying BI aggregations that want to display an icon,
+for example when a service is in downtime, an exception like
+this could occur: TypeError: render_icon() got an unexpected keyword argument 'class_'.
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 0357c31..c7ed416 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -2802,7 +2802,7 @@ class html(HTMLGenerator, RequestHandler):
self.write_html(self.render_icon("images/trans.png"))
- def render_icon(self, icon_name, help=None, middle=True, id=None, cssclass=None):
+ def render_icon(self, icon_name, help=None, middle=True, id=None, cssclass=None, class_=None):
# TODO: Refactor
title = help
@@ -2814,6 +2814,9 @@ class html(HTMLGenerator, RequestHandler):
'align' : 'absmiddle' if middle else None,
'src' : icon_name if "/" in icon_name else self.detect_icon_path(icon_name)}
+ if class_:
+ attributes['class'].extend(class_)
+
return self._render_opening_tag('img', close_tag=True, **attributes)
Module: check_mk
Branch: master
Commit: 9540bf31186d96c55b99df3b94adfd908d9eebdb
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9540bf31186d96…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 16 16:00:39 2018 +0200
Fixed possible exception when playing sounds is enabled
When a host / service reports a state code that is not a normal
monitoring state (e.g. 126), then an exception could occur when
playing sounds is enabled.
Change-Id: If1fce996b389a72a99a7a49ecc697dbbe0083a12
---
web/htdocs/views.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index d1016ce..5966ac9 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2037,8 +2037,15 @@ def save_state_for_playing_alarm_sounds(row):
for state_map, state in [
(host_state_map, row.get("host_hard_state", row.get("host_state"))),
(service_state_map, row.get("service_last_hard_state", row.get("service_state"))) ]:
- if state != None:
- g_alarm_sound_states.add(state_map[int(state)])
+ if state is None:
+ continue
+
+ try:
+ state_name = state_map[int(state)]
+ except KeyError:
+ continue
+
+ g_alarm_sound_states.add(state_name)
def play_alarm_sounds():
Module: check_mk
Branch: master
Commit: 35ac8516e74ea5ad877056a25b1539e7e6b79ead
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=35ac8516e74ea5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 16 21:48:55 2018 +0200
5983 FIX docker_node_images: Fixed mixups between images of same repository and different tags
The number of containers was not counted per image because the tag information
was not handled correctly in all cases.
Some containers don't explicitly state "repository:tag" but only "repository"
as their image, depending on the "docker run" call. Check_MK is now falling
back to "latest" tag in this case.
Change-Id: I2fc33ced414d040eaf9dde683d1478cdc288d653
---
.werks/5983 | 16 ++++++++++++++++
agents/check_mk_agent.linux | 2 +-
inventory/docker_node_images | 24 ++++++++++++++++--------
3 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/.werks/5983 b/.werks/5983
new file mode 100644
index 0000000..053d6fc
--- /dev/null
+++ b/.werks/5983
@@ -0,0 +1,16 @@
+Title: docker_node_images: Fixed mixups between images of same repository and different tags
+Level: 1
+Component: inv
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1523907880
+
+The number of containers was not counted per image because the tag information
+was not handled correctly in all cases.
+
+Some containers don't explicitly state "repository:tag" but only "repository"
+as their image, depending on the "docker run" call. Check_MK is now falling
+back to "latest" tag in this case.
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 9682327..1f58f8e 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -976,7 +976,7 @@ if type docker > /dev/null 2>&1 ; then
echo "<<<docker_node_images>>>"
echo "[[[images]]]"
docker images --all --format "{{json .}}"
- for image in $(docker images --all --format "{{.Repository}}");
+ for image in $(docker images --all --format "{{.Repository}}:{{.Tag}}");
do
echo "[[[images_labels:$image]]]"
docker image inspect --format "{{json .Config.Labels}}" "$image"
diff --git a/inventory/docker_node_images b/inventory/docker_node_images
index 4565a55..c9be7fa 100644
--- a/inventory/docker_node_images
+++ b/inventory/docker_node_images
@@ -35,17 +35,26 @@ def _parse_docker_node_images(info):
continue
data = json.loads(" ".join(line))
+
if section_name == "images":
- parsed.setdefault(data["Repository"], data)
+ parsed.setdefault((data["Repository"], data["Tag"]), data)
elif section_name.startswith("images_labels"):
- _, image_id = section_name.split(":", 1)
- image = parsed.get(image_id)
- if image is not None and data:
- image.setdefault("__labels__", data)
+ parts = section_name.split(":", 2)
+ if len(parts) == 3:
+ repository, tag = parts[1:]
+ image = parsed.get((repository, tag))
+ if image is not None and data:
+ image.setdefault("__labels__", data)
elif section_name == "containers":
- image = parsed.get(data["Image"])
+ image_name = data["Image"]
+ if ":" in image_name:
+ repository, tag = image_name.split(":", 1)
+ else:
+ repository, tag = image_name, "latest"
+
+ image = parsed.get((repository, tag))
if image is not None:
image.setdefault("__containers__", []).append(data)
return parsed
@@ -57,8 +66,7 @@ def inv_docker_node_images(info, inventory_tree, status_data_tree):
inv_node = inventory_tree.get_list(path)
status_node = status_data_tree.get_list(path)
- for repo, image in parsed.iteritems():
- tag = image["Tag"]
+ for (repo, tag), image in parsed.iteritems():
id_ = image["ID"]
inv_node.append({
"repository" : repo,