Module: check_mk
Branch: master
Commit: 81415ac849f22732f6c4c9df19f0a673af753f9c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=81415ac849f227…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Dec 6 14:23:27 2017 +0100
5452 FIX Highly improved performance of rendering large tables of HW/SW inventory trees
This may also concern other pages or views.
Change-Id: Iefad8e06d8c763e805e946a5e6ba76c030bb98ca
---
.werks/5452 | 10 ++++++++++
web/htdocs/htmllib.py | 12 ++++++------
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/.werks/5452 b/.werks/5452
new file mode 100644
index 0000000..8ebcba7
--- /dev/null
+++ b/.werks/5452
@@ -0,0 +1,10 @@
+Title: Highly improved performance of rendering large tables of HW/SW inventory trees
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.5.0i2
+Date: 1512566453
+Class: fix
+
+This may also concern other pages or views.
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 65bcfdb..c11a0b9 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -437,7 +437,7 @@ class OutputFunnel(object):
raise MKGeneralException(_('Type Error: html.write accepts str and unicode input objects only!'))
if self.is_plugged():
- self.plug_text[self.plug_level] += text
+ self.plug_text[self.plug_level].append(text)
else:
# encode when really writing out the data. Not when writing plugged,
# because the plugged code will be handled somehow by our code. We
@@ -465,7 +465,7 @@ class OutputFunnel(object):
# Put in a plug which stops the text stream and redirects it to a sink.
def plug(self):
- self.plug_text.append('')
+ self.plug_text.append([])
self.plug_level += 1
@@ -478,8 +478,8 @@ class OutputFunnel(object):
if not self.is_plugged():
return None
- text = self.plug_text[self.plug_level]
- self.plug_text[self.plug_level] = ""
+ text = "".join(self.plug_text[self.plug_level])
+ self.plug_text[self.plug_level] = []
self.plug_level -= 1
self.write(text)
self.plug_level += 1
@@ -490,8 +490,8 @@ class OutputFunnel(object):
if not self.is_plugged():
return ''
- text = self.plug_text[self.plug_level]
- self.plug_text[self.plug_level] = ''
+ text = "".join(self.plug_text[self.plug_level])
+ self.plug_text[self.plug_level] = []
return text
Module: check_mk
Branch: master
Commit: 6c602246f3e40affa7b69b8d452f23dd4f9b0231
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6c602246f3e40a…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Wed Dec 6 09:15:23 2017 +0100
Remove werk
Change-Id: Id6cc65e0d1900ce9921180494109c5bf88f7fffd
---
.werks/5524 | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/.werks/5524 b/.werks/5524
deleted file mode 100644
index 9698b65..0000000
--- a/.werks/5524
+++ /dev/null
@@ -1,11 +0,0 @@
-Title: Check API: Fix set_item_state/get_rate/get_counter logic when called from check functions
-Level: 2
-Component: checks
-Compatible: compat
-Edition: cre
-Version: 1.5.0i2
-Date: 1512494383
-Class: fix
-
-In the 1.5.0 branch, the logic encoding the current item in the key for saved data between checks
-was broken for checks with item and parse function. This did not affect the 1.4.0 branch.
Module: check_mk
Branch: master
Commit: 47eeadd6a6cd9d1bb7005774b069dc89dfc7a427
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=47eeadd6a6cd9d…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Tue Dec 5 18:22:30 2017 +0100
5524 FIX Check API: Fix set_item_state/get_rate/get_counter logic when called from check functions
In the 1.5.0 branch, the logic encoding the current item in the key for saved data between checks
was broken for checks with item and parse function. This did not affect the 1.4.0 branch.
Change-Id: I689f8272b6f4e9e17861f845adb75f9a09bfabe0
---
.werks/5524 | 11 +++++++++++
cmk_base/checking.py | 6 ++++++
2 files changed, 17 insertions(+)
diff --git a/.werks/5524 b/.werks/5524
new file mode 100644
index 0000000..9698b65
--- /dev/null
+++ b/.werks/5524
@@ -0,0 +1,11 @@
+Title: Check API: Fix set_item_state/get_rate/get_counter logic when called from check functions
+Level: 2
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i2
+Date: 1512494383
+Class: fix
+
+In the 1.5.0 branch, the logic encoding the current item in the key for saved data between checks
+was broken for checks with item and parse function. This did not affect the 1.4.0 branch.
diff --git a/cmk_base/checking.py b/cmk_base/checking.py
index 81a7861..0b64e34 100644
--- a/cmk_base/checking.py
+++ b/cmk_base/checking.py
@@ -308,6 +308,12 @@ def execute_check(multi_host_sections, hostname, ipaddress, check_plugin_name, i
x = e.exc_info()
raise x[0], x[1], x[2] # re-raise the original exception to not destory the trace
+ # We need to set this again, because get_section_content has the side effect of setting this with
+ # item None if there is a parse function. This would break the entire set_item/get_rate logic
+ # for checks with items that rely on this being handled by the API.
+ # TODO: Write a regression test for this.
+ item_state.set_item_state_prefix(check_plugin_name, item)
+
# TODO: Move this to a helper function
if section_content is None: # No data for this check type
return False