Module: check_mk
Branch: master
Commit: 8cb6be6044d9900548f4dcab6164db181920b9d2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8cb6be6044d990…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sat Nov 18 13:56:22 2017 +0100
Fixed some issues introduced with last commit
Change-Id: Id2841b4f58c7e6298560f2d7abbe99ab3d946a01
---
web/htdocs/wato.py | 2 +-
web/htdocs/watolib.py | 2 +-
web/plugins/wato/bp_tests.py | 144 ++++++++-----------------------------------
3 files changed, 28 insertions(+), 120 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index bf012d3..871006a 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -16452,7 +16452,7 @@ class ModeBestPractices(WatoMode):
if not site_id:
raise MKUserError("_ack_site_id", _("Needed variable missing"))
- if site_id not in ActivateChanges().activation_site_ids():
+ if site_id not in watolib.ActivateChanges().activation_site_ids():
raise MKUserError("_ack_site_id", _("Invalid site given"))
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 62d0cb4..846d833 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -9440,7 +9440,7 @@ class BPTest(object):
def status_name(self):
- return short_service_state_name(self.status())
+ return cmk.defines.short_service_state_name(self.status())
@property
diff --git a/web/plugins/wato/bp_tests.py b/web/plugins/wato/bp_tests.py
index 484edf8..f52227e 100644
--- a/web/plugins/wato/bp_tests.py
+++ b/web/plugins/wato/bp_tests.py
@@ -57,7 +57,7 @@ class BPTestPersistentConnections(BPTest):
site_config = config.site(site_id)
persist = site_config.get("persist", False)
- if persist and site_is_using_livestatus_proxy(site_id):
+ if persist and watolib.site_is_using_livestatus_proxy(site_id):
yield BPResultWARN(
_("Persistent connections are nearly useless "
"with Livestatus Proxy Daemon. Better disable it."))
@@ -85,9 +85,15 @@ class BPTestLivestatusUsage(BPTest):
def help(self):
- return _("You should never reach a livestatus usage of 100% for a longer time. "
- "consider increasing number of parallel livestatus connections or track down "
- "the clients to check whether or not you can reduce the usage somehow.")
+ return _("<p>Livestatus is used by several components, for example the GUI, to gather "
+ "information about the monitored objects from the monitoring core. It is "
+ "very important for the overall performance of the monitoring system that "
+ "livestatus is a reliable and performant.</p>"
+ "<p>There should always be enough free livestatus slots to serve new "
+ "incoming queries.</p>"
+ "<p>You should never reach a livestatus usage of 100% for a longer time. "
+ "Consider increasing number of parallel livestatus connections or track down "
+ "the clients to check whether or not you can reduce the usage somehow.</p>")
def is_relevant(self):
@@ -95,25 +101,26 @@ class BPTestLivestatusUsage(BPTest):
def execute(self):
- sites.live().set_only_sites([config.omd_site()])
- try:
- site_status = sites.live().query_row(
- "GET status\n"
- "Columns: livestatus_usage livestatus_threads livestatus_active_connections livestatus_overflows_rate"
- )
- finally:
- sites.live().set_only_sites()
+ local_connection = sites.livestatus.LocalConnection()
+ site_status = local_connection.query_row(
+ "GET status\n"
+ "Columns: livestatus_usage livestatus_threads livestatus_active_connections livestatus_overflows_rate"
+ )
usage, threads, active_connections, overflows_rate = site_status
+ usage_perc = 100 * usage
- number_txt = "(%d of %d connections used)" % (active_connections, threads)
- if usage > 90:
- yield BPResultWARN(_("The usage is %0.2f%% (above %0.2f%%), check "
- "the usage over time and possibly adapt configuration%s") % number_txt)
+ usage_warn, usage_crit = 80, 95
+ if usage_perc >= usage_crit:
+ cls = BPResultCRIT
+ elif usage_perc >= usage_warn:
+ cls = BPResultWARN
+ else:
+ cls = BPResultOK
- if overflows_rate > 1:
- yield BPResultCRIT(_("%0.2f/s overflows occured. "
- "Clients need to wait for connections%s") % number_txt)
+ yield cls(_("The current livestatus usage is %.2f%%. You have a connection overflow "
+ "rate of %.2f/s. %d of %d connections used") %
+ (usage_perc, overflows_rate, active_connections, threads))
@@ -407,50 +414,6 @@ class BPTestApacheProcessUsage(BPTest, BPApacheTest):
-class BPTestLivestatusUsage(BPTest, BPApacheTest):
- def category(self):
- return BPTestCategories.performance
-
-
- def title(self):
- return _("Livestatus usage")
-
-
- def help(self):
- return _("<p>Livestatus is used by several components, for example the GUI, to gather "
- "information about the monitored objects from the monitoring core. It is "
- "very important for the overall performance of the monitoring system that "
- "livestatus is a reliable and performant.</p>"
- "<p>There should always be enough free livestatus slots to serve new "
- "incoming queries.</p>")
-
-
- def is_relevant(self):
- return True
-
-
- def execute(self):
- local_connection = sites.livestatus.LocalConnection()
- row = local_connection.query_row(
- "GET status\nColumns: livestatus_usage livestatus_overflows_rate\n"
- )
-
- livestatus_usage_perc = 100 * row[0]
- livestatus_overflows_per_sec = row[1]
-
- usage_warn, usage_crit = 80, 95
- if livestatus_usage_perc >= usage_crit:
- cls = BPResultCRIT
- elif livestatus_usage_perc >= usage_warn:
- cls = BPResultWARN
- else:
- cls = BPResultOK
-
- yield cls(_("The current livestatus usage is %.2f%%. You have a connection overflow "
- "rate of %.2f/s.") % (livestatus_usage_perc, livestatus_overflows_per_sec))
-
-
-
class BPTestCheckMKHelperUsage(BPTest):
def category(self):
return BPTestCategories.performance
@@ -511,60 +474,6 @@ class BPTestCheckMKHelperUsage(BPTest):
-class BPTestApacheNumberOfProcesses(BPTest, BPApacheTest):
- def category(self):
- return BPTestCategories.performance
-
-
- def title(self):
- return _("Apache number of processes")
-
-
- def help(self):
- return _("<p>The apache has a number maximum processes it can start in case of high "
- "load situations. These apache processes may use a decent amount of memory, so "
- "you need to configure them in a way that you system can handle them without "
- "reaching out of memory situations.</p>"
- "<p>Please note that this value is only a rough estimation, because the memory "
- "usage of the apache processes may vary with the requests being processed.</p>")
-
-
- def is_relevant(self):
- return True
-
-
- def execute(self):
- process_limit = self._get_maximum_number_of_processes()
- average_process_size = self._get_average_process_size()
-
- estimated_memory_size = process_limit * (average_process_size * 1.2)
-
- yield BPResultWARN(_("The apache may start up to %d processes while the current "
- "average process size is %s. With this numbers the apache may "
- "use up to %s RAM. Please ensure that your system is able to "
- "handle this.") % (process_limit, cmk.render.bytes(average_process_size),
- cmk.render.bytes(estimated_memory_size)))
-
-
- def _get_average_process_size(self):
- try:
- ppid = int(open("%s/tmp/apache/run/apache.pid" % cmk.paths.omd_root).read())
- except IOError, ValueError:
- raise MKGeneralException(_("Failed to read the apache process ID"))
-
- sizes = []
- for pid in os.popen("ps --ppid %s h o pid" % ppid):
- summary_line = os.popen("pmap -d %d" % int(pid)).readlines()[-1]
- sizes.append(int(summary_line.split()[3][:-1])*1024.0)
-
- if not sizes:
- raise MKGeneralException(_("Failed to estimate the apache process size"))
-
- return sum(sizes) / float(len(sizes))
-
-
-
-
class BPTestGenericCheckHelperUsage(BPTest):
def category(self):
return BPTestCategories.performance
@@ -638,7 +547,6 @@ class BPTestSizeOfExtensions(BPTest):
def is_relevant(self):
- return True
return config.has_wato_slave_sites() and self._replicates_mkps()
Module: check_mk
Branch: master
Commit: b3d8743eacc6ee5d6527e2d40ec1c64b4c4b40c7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b3d8743eacc6ee…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 17 16:24:41 2017 +0100
5531 New WATO page "Best practices" can be used to find things to improve in your Check_MK
The new WATO page "Best practices" is meant to give you hints about your Check_MK installation
and the things you could improve in terms of performance, reliabilty and security.
In the moment you open the page, it starts analyzing your Check_MK installation and executes
different tests. Test may detect that a thing is OK and report the test to be OK. Other
tests may result in WARN state in case you could be interested in changing something.
Other tests may report a CRIT state in case we think that you have a critical situation which
should be fixed for a completely working Check_MK setup.
Please note that this feature and the implemented tests are still in an early phase of
development. Understand the test results as pointer on things you should check.
Each of the tests can be acknowledged just for a single site or all your sites. In case you
came to the decision that a reported problem is not really a problem for you, you can
acknowledge the test results.
In case you fix a problem, you won't need to acknowledge it. Just open up the page again,
which should then turn your test into OK.
Change-Id: I3f665f6b2a54e8ca5f24b36fc2fa81a8ecbc1752
---
.werks/5531 | 27 +
web/htdocs/backup.py | 4 +
web/htdocs/images/button_acknowledge_test.png | Bin 0 -> 2217 bytes
web/htdocs/images/button_acknowledge_test_all.png | Bin 0 -> 4711 bytes
web/htdocs/images/button_unacknowledge_test.png | Bin 0 -> 2730 bytes
.../images/button_unacknowledge_test_all.png | Bin 0 -> 4956 bytes
web/htdocs/images/icon_best_practices.png | Bin 0 -> 1732 bytes
web/htdocs/wato.css | 40 ++
web/htdocs/wato.py | 283 ++++++++-
web/htdocs/watolib.py | 217 +++++++
web/plugins/userdb/ldap.py | 6 +-
web/plugins/views/builtin.py | 39 ++
web/plugins/wato/bp_tests.py | 667 +++++++++++++++++++++
web/plugins/wato/builtin_modules.py | 3 +
web/plugins/wato/omd_configuration.py | 4 +-
15 files changed, 1286 insertions(+), 4 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=b3d8743eac…
Module: check_mk
Branch: master
Commit: 221fb4ef63dd4dfe801107e92b8c1a7af1c80b6e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=221fb4ef63dd4d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 17 15:09:27 2017 +0100
5530 FIX Clicking on "Edit dashboard" accidentially copied dashboards with "publish to others"
When one clicks on "Edit dashboard" to edit the currently visible dashboard and the dashboard
is not owned by this user, the dashboard is cloned in the context of the current user. This
is intended and equal to, for example, the views.
What was unintended is the fact that the "public" flag of the cloned dashboards was not forced
to be forced. This way all users (with enough permissions) were publishing their cloned views
leading to strang situations where from time to time a user could see different dashboards.
The "Make this dashboard available for other users" is forced to be unchecked. This way a user
clones the dashboard for himself in the first place.
Change-Id: Id4e99498f697646460dcaf67091ff95a4260bd5b
---
.werks/5530 | 20 ++++++++++++++++++++
web/htdocs/dashboard.py | 1 +
2 files changed, 21 insertions(+)
diff --git a/.werks/5530 b/.werks/5530
new file mode 100644
index 0000000..d18b93a
--- /dev/null
+++ b/.werks/5530
@@ -0,0 +1,20 @@
+Title: Clicking on "Edit dashboard" accidentially copied dashboards with "publish to others"
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1510927527
+
+When one clicks on "Edit dashboard" to edit the currently visible dashboard and the dashboard
+is not owned by this user, the dashboard is cloned in the context of the current user. This
+is intended and equal to, for example, the views.
+
+What was unintended is the fact that the "public" flag of the cloned dashboards was not forced
+to be forced. This way all users (with enough permissions) were publishing their cloned views
+leading to strang situations where from time to time a user could see different dashboards.
+
+The "Make this dashboard available for other users" is forced to be unchecked. This way a user
+clones the dashboard for himself in the first place.
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index 145935e..8389e33 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -314,6 +314,7 @@ def load_dashboard_with_cloning(name, edit = True):
# cloned now!
board = copy.deepcopy(board)
board['owner'] = config.user.id
+ board['public'] = False
dashboards[(config.user.id, name)] = board
available_dashboards[name] = board
Module: check_mk
Branch: master
Commit: 60994a9097796a71d3cc3b47f42e5b2f14aa4239
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=60994a9097796a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 17 15:03:51 2017 +0100
5529 FIX Fixed accidentially cloning own visuals instead of builtin visuals
It could happen that one wanted to clone a builtin visual (e.g. dashboard)
but was cloning his own visual instead.
This could happen if the user already has a visual with the exact name like
the visual he tried to clone.
Change-Id: I43fd406cf47e61d46c2fd5344b426f8289c5393a
---
.werks/5529 | 15 +++++++++++++++
web/htdocs/visuals.py | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/.werks/5529 b/.werks/5529
new file mode 100644
index 0000000..761ce8c
--- /dev/null
+++ b/.werks/5529
@@ -0,0 +1,15 @@
+Title: Fixed accidentially cloning own visuals instead of builtin visuals
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1510927292
+
+It could happen that one wanted to clone a builtin visual (e.g. dashboard)
+but was cloning his own visual instead.
+
+This could happen if the user already has a visual with the exact name like
+the visual he tried to clone.
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index 1b01ed6..93ac934 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -645,7 +645,7 @@ def page_edit_visual(what, all_visuals, custom_field_handler = None,
mode = html.var('mode', 'edit')
if visualname:
cloneuser = html.var("load_user")
- if cloneuser:
+ if cloneuser is not None:
mode = 'clone'
visual = copy.deepcopy(all_visuals.get((cloneuser, visualname), None))
if not visual:
Module: check_mk
Branch: master
Commit: c838a5bd516094ceb031da29fe7c263c91f36bf1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c838a5bd516094…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 17 14:02:45 2017 +0100
5528 FIX Fixed showing help when executing "omd" without mode argument (1.4.0p18 regression)
With 1.4.0p18 the output of the help text when executing the "omd" command without argument
broke. It printed an exception instead of the help text. As workaround you can execute
"omd help" to get the help text.
Change-Id: I2097d475037fc7d9c288376f232fa1e7eb8501a4
---
.werks/5528 | 12 ++++++++++++
omd/packages/omd/omd | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/.werks/5528 b/.werks/5528
new file mode 100644
index 0000000..70598f4
--- /dev/null
+++ b/.werks/5528
@@ -0,0 +1,12 @@
+Title: Fixed showing help when executing "omd" without mode argument (1.4.0p18 regression)
+Level: 1
+Component: omd
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1510923599
+Class: fix
+
+With 1.4.0p18 the output of the help text when executing the "omd" command without argument
+broke. It printed an exception instead of the help text. As workaround you can execute
+"omd help" to get the help text.
diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd
index edd16cc..9091cec 100644
--- a/omd/packages/omd/omd
+++ b/omd/packages/omd/omd
@@ -31,7 +31,7 @@
# python libraries. Newer versions unset these variables before, so this
# additional execv() is only needed when updating from older versions.
import os, sys
-if sys.argv[1] == "update" and sys.version_info[2] != 14:
+if len(sys.argv) > 1 and sys.argv[1] == "update" and sys.version_info[2] != 14:
# Prevent inheriting environment variables from this versions/site environment
# into the execed omd call. The OMD call must import the python version related
# modules and libaries. This only works when PYTHONPATH and LD_LIBRARY_PATH are
Module: check_mk
Branch: master
Commit: 8935532fc5f539f244d8b0084bdcd0a346dce610
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8935532fc5f539…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Fri Nov 17 13:53:49 2017 +0100
5518 FIX win.mem: Fix incorrect representation of absolute memory levels in graphs
Previously, a warn or crit level of eg. 20 GB would be displayed in the graph as 20 TB
due to the levels not being set to the same unit as the performance value itself.
The problem only affected the levels passed to the metrics system for representation,
not the actual levels used for evaluation.
Change-Id: Id9845a02f886226d58f13a1734613f7b5f5f9b8d
---
.werks/5518 | 14 ++++++++++++++
checks/mem | 4 ++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/.werks/5518 b/.werks/5518
new file mode 100644
index 0000000..35120e8
--- /dev/null
+++ b/.werks/5518
@@ -0,0 +1,14 @@
+Title: win.mem: Fix incorrect representation of absolute memory levels in graphs
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1510923049
+
+Previously, a warn or crit level of eg. 20 GB would be displayed in the graph as 20 TB
+due to the levels not being set to the same unit as the performance value itself.
+The problem only affected the levels passed to the metrics system for representation,
+not the actual levels used for evaluation.
diff --git a/checks/mem b/checks/mem
index 7d0ce96..d90f085 100644
--- a/checks/mem
+++ b/checks/mem
@@ -500,11 +500,11 @@ def check_mem_windows(item, params, info):
else:
crit_kb = crit * 1024
- perfdata = [(paramname, used_kb / 1024.0, warn_kb, crit_kb, 0, total_kb / 1024.0)]
+ perfdata = [(paramname, used_kb/1024.0, warn_kb/1024.0, crit_kb/1024.0, 0, total_kb/1024.0)]
# Predictive levels have no level information in the performance data
else:
- perfdata = [(paramname, used_kb / 1024.0, None, None, 0, total_kb / 1024.0)]
+ perfdata = [(paramname, used_kb/1024.0, None, None, 0, total_kb/1024.0)]
if what == "Mem":
perfdata.append(("mem_total", total_kb / 1024.0))