Module: check_mk
Branch: master
Commit: f77b690f8492f8c201d8b322a47a48aa307f3a6b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f77b690f8492f8…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Thu Nov 8 11:43:50 2018 +0100
wmi.include, wmi_cpuload: Own discovery function for wmi_cpuload
Eliminate 'skip_intersection' keyword argument
Change-Id: I6e1acba344361ab5e7bdd28a695986d87929a4b1
---
checks/wmi.include | 24 +++++++-----------------
checks/wmi_cpuload | 10 ++++++----
2 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/checks/wmi.include b/checks/wmi.include
index 058f378..8162ee0 100644
--- a/checks/wmi.include
+++ b/checks/wmi.include
@@ -261,23 +261,13 @@ def inventory_wmi_table(tables, **kwargs):
return []
potential_instances = set()
- if kwargs.get("skip_intersection", False):
- # Unfortunately there are tables which do NOT provide any
- # names. In this case we fallback to old behaviour.
- #
- # Eg. wmi_cpuload check plugin:
- # 'system_perf' section has only counters and comes together
- # with 'computer_system' which has table names and intersection
- # of these tables would be empty. Thus no service is discovered.
- potential_instances = set([None])
- else:
- # inventarize one item per instance that exists in all tables
- for required_table in required_tables:
- table_rows = tables[required_table].row_labels()
- if potential_instances:
- potential_instances &= set(table_rows)
- else:
- potential_instances = set(table_rows)
+ # inventarize one item per instance that exists in all tables
+ for required_table in required_tables:
+ table_rows = tables[required_table].row_labels()
+ if potential_instances:
+ potential_instances &= set(table_rows)
+ else:
+ potential_instances = set(table_rows)
# if there are multiple instances, don't include the summary line as it is redundant
if len(potential_instances) > 1:
diff --git a/checks/wmi_cpuload b/checks/wmi_cpuload
index 0a96466..a4dc9ed 100644
--- a/checks/wmi_cpuload
+++ b/checks/wmi_cpuload
@@ -25,10 +25,12 @@
# Boston, MA 02110-1301 USA.
-def inventory_wmi_cpuload(parsed):
- return inventory_wmi_table(parsed, \
- required_tables = [ "computer_system", "system_perf" ],
- skip_intersection=True)
+def inventory_wmi_cpuload(tables):
+ if ("computer_system" not in tables.keys() or
+ "system_perf" not in tables.keys() or
+ any(isinstance(table, NullTable) for table in tables.itervalues())):
+ return []
+ return [(None, None)]
def check_wmi_cpuload(item, params, parsed):
Module: check_mk
Branch: master
Commit: f3bb5610f9cc7b6ba13640ea7731913863992bb4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f3bb5610f9cc7b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 9 17:02:14 2018 +0100
6855 FIX Locally installed notification plugins were not immediately available
When installing a new notification plugin to local/share/check_mk/notifications
this script was not immediately visible in the configuration GUI in all
previous 1.5 releases.
Workaround: Restarting the site apache made the script available in previous
versions.
Change-Id: I9d2f5d4ea853b63a1ba59df0ebdc57f17151b772
---
.werks/6855 | 16 ++++++++++++++++
cmk/gui/notifications.py | 45 +++++++++++++++++----------------------------
2 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/.werks/6855 b/.werks/6855
new file mode 100644
index 0000000..12bbfc1
--- /dev/null
+++ b/.werks/6855
@@ -0,0 +1,16 @@
+Title: Locally installed notification plugins were not immediately available
+Level: 1
+Component: notifications
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1541754471
+
+When installing a new notification plugin to local/share/check_mk/notifications
+this script was not immediately visible in the configuration GUI in all
+previous 1.5 releases.
+
+Workaround: Restarting the site apache made the script available in previous
+versions.
diff --git a/cmk/gui/notifications.py b/cmk/gui/notifications.py
index 5953353..6b56782 100644
--- a/cmk/gui/notifications.py
+++ b/cmk/gui/notifications.py
@@ -38,31 +38,20 @@ from cmk.gui.i18n import _u, _
from cmk.gui.globals import html
g_acknowledgement_time = {}
-g_modified_time = 0
-g_columns = ["time", "contact_name", "type", "host_name",
- "service_description", "comment"]
-loaded_with_language = False
+g_modified_time = 0
+g_columns = ["time", "contact_name", "type", "host_name", "service_description", "comment"]
+# The permissions need to be loaded dynamically on each page load instead of
+# only when the plugins need to be loaded because the user may have placed
+# new notification plugins in the local hierarchy.
def load_plugins(force):
- global loaded_with_language
- if loaded_with_language == cmk.gui.i18n.get_current_language() and not force:
- return
-
- config.declare_permission_section("notification_plugin",
- _("Notification plugins"),
- do_sort = True)
+ config.declare_permission_section(
+ "notification_plugin", _("Notification plugins"), do_sort=True)
for name, attrs in watolib.load_notification_scripts().items():
- config.declare_permission(
- "notification_plugin.%s" % name,
- _u(attrs["title"]), u"",
- [ "admin", "user" ])
-
- # This must be set after plugin loading to make broken plugins raise
- # exceptions all the time and not only the first time (when the plugins
- # are loaded).
- loaded_with_language = cmk.gui.i18n.get_current_language()
+ config.declare_permission("notification_plugin.%s" % name, _u(attrs["title"]), u"",
+ ["admin", "user"])
def acknowledge_failed_notifications(timestamp):
@@ -139,7 +128,7 @@ def load_failed_notifications(before=None, after=None, stat_only=False, extra_he
if stat_only:
result = sites.live().query_summed_stats(query)
if result is None:
- result = [0] # Normalize the result when no site answered
+ result = [0] # Normalize the result when no site answered
if result[0] == 0 and not sites.live().dead_sites():
# In case there are no errors and all sites are reachable:
@@ -159,19 +148,20 @@ def render_notification_table(failed_notifications):
for row in failed_notifications:
table.row()
- table.cell(_("Time"), cmk.render.approx_age(time.time() - row[header['time']]))
+ table.cell(_("Time"), cmk.render.approx_age(time.time() - row[header['time']]))
table.cell(_("Contact"), row[header['contact_name']])
- table.cell(_("Plugin"), row[header['type']])
- table.cell(_("Host"), row[header['host_name']])
+ table.cell(_("Plugin"), row[header['type']])
+ table.cell(_("Host"), row[header['host_name']])
table.cell(_("Service"), row[header['service_description']])
- table.cell(_("Output"), row[header['comment']])
+ table.cell(_("Output"), row[header['comment']])
table.end()
# TODO: We should really recode this to use the view and a normal view command / action
def render_page_confirm(acktime, prev_url, failed_notifications):
- html.header(_("Confirm failed notifications"), javascripts=[], stylesheets=[ "pages", "check_mk" ])
+ html.header(
+ _("Confirm failed notifications"), javascripts=[], stylesheets=["pages", "check_mk"])
if failed_notifications:
html.open_div(class_="really")
@@ -206,6 +196,5 @@ def page_clear():
cmk.gui.wato.user_profile.user_profile_async_replication_page()
return
- failed_notifications = load_failed_notifications(before=acktime,
- after=acknowledged_time())
+ failed_notifications = load_failed_notifications(before=acktime, after=acknowledged_time())
render_page_confirm(acktime, prev_url, failed_notifications)
Module: check_mk
Branch: master
Commit: df0fe1f79454156e5e170a938e905b4cb715c343
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=df0fe1f7945415…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Fri Nov 9 11:05:19 2018 +0100
6416 FIX mknotifyd: set a default timeout if no value is given for a method
If the option "Timing settings for specific methods" was used for a notification
method and no explicit timeout was given an exception was raised in the mknotifyd
if a timeout occured. As a result notification processes that run in a timeout
are not killed, the list of notifications that are in progress are not updated
as long as the timed out process exists and the output of the timed out process
is discarded.
The issue is now fixed and the default timeout of 60s is set if no timeout
is specified in the global settings.
If you use the option "Timing settings for specific methods" in versions prior
to 1.5.0p8 please set a timeout explicitlyto circumvent this issue.
Change-Id: I25de48609ab6c00cd594374ffca2c1698c9ed253
---
.werks/6416 | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/.werks/6416 b/.werks/6416
new file mode 100644
index 0000000..69c7fc6
--- /dev/null
+++ b/.werks/6416
@@ -0,0 +1,22 @@
+Title: mknotifyd: set a default timeout if no value is given for a method
+Level: 1
+Component: notifications
+Class: fix
+Compatible: incomp
+Edition: cee
+State: unknown
+Version: 1.6.0i1
+Date: 1541754179
+
+If the option "Timing settings for specific methods" was used for a notification
+method and no explicit timeout was given an exception was raised in the mknotifyd
+if a timeout occured. As a result notification processes that run in a timeout
+are not killed, the list of notifications that are in progress are not updated
+as long as the timed out process exists and the output of the timed out process
+is discarded.
+
+The issue is now fixed and the default timeout of 60s is set if no timeout
+is specified in the global settings.
+
+If you use the option "Timing settings for specific methods" in versions prior
+to 1.5.0p8 please set a timeout explicitlyto circumvent this issue.