Module: check_mk
Branch: master
Commit: 6e1c25443e26021de1580a0e436ed8e9cdb24ab6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6e1c25443e2602…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Mar 14 14:49:03 2013 +0100
FIX: speedup for single host tables joined by hostname
Conflicts:
ChangeLog
---
ChangeLog | 5 +++++
web/htdocs/bi.py | 44 ++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bb510cd..b383c3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -94,6 +94,11 @@
* Quicksearch: allow searching for complete IP addresses and IP
address prefixes
+ BI:
+ * FIX: fix exception with expansion level being 'None'
+ * FIX: speedup for single host tables joined by hostname (BI-Boxes)
+
+
1.2.2b4:
Core:
* FIX: Fix output of cmk -D: datasource programs were missing
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 74fc22d..a1c9ae2 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -1421,7 +1421,7 @@ def render_tree_foldable(row, boxes, omit_root, expansion_level, only_problems,
omit = omit_root and len(path) == 1
if not omit:
h += '<span id="%d:%s" %s class="bibox_box %s %s state state%s%s">' % (
- expansion_level, path_id, mc, leaf, is_open and "open" or "closed", effective_state["state"], addclass)
+ expansion_level or 0, path_id, mc, leaf, is_open and "open" or "closed", effective_state["state"], addclass)
if is_leaf:
h += aggr_render_leaf(tree, show_host, bare = True) # .replace(" ", " ")
else:
@@ -1705,7 +1705,10 @@ def host_table(columns, add_headers, only_sites, limit, filters):
return singlehost_table(columns, add_headers, only_sites, limit, filters, False)
def singlehost_table(columns, add_headers, only_sites, limit, filters, joinbyname):
+ log("--------------------------------------------------------------------\n")
+ log("* Starting to compute singlehost_table (joinbyname = %s)\n" % joinbyname)
load_assumptions() # user specific, always loaded
+ log("* Assumptions are loaded.\n")
# Create livestatus filter for filtering out hosts. We can
# simply use all those filters since we have a 1:n mapping between
@@ -1716,8 +1719,10 @@ def singlehost_table(columns, add_headers, only_sites, limit, filters, joinbynam
if not header.startswith("Sites:"):
filter_code += header
+ log("* Getting status information about hosts...\n")
host_columns = filter(lambda c: c.startswith("host_"), columns)
hostrows = get_status_info_filtered(filter_code, only_sites, limit, host_columns, config.bi_precompile_on_demand)
+ log("* Got %d host rows\n" % len(hostrows))
# if limit:
# views.check_limit(hostrows, limit)
@@ -1733,9 +1738,11 @@ def singlehost_table(columns, add_headers, only_sites, limit, filters, joinbynam
only_groups = [ filt.selected_group() ]
if config.bi_precompile_on_demand:
+ log("* Compiling forest on demand...\n")
compile_forest(config.user_id, only_groups = only_groups,
only_hosts = [ (h['site'], h['name']) for h in hostrows ])
else:
+ log("* Compiling forest...\n")
compile_forest(config.user_id)
# rows by site/host - needed for later cluster state gathering
@@ -1744,12 +1751,44 @@ def singlehost_table(columns, add_headers, only_sites, limit, filters, joinbynam
rows = []
# Now compute aggregations of these hosts
+ log("* Assembling host rows...\n")
+
+ # Special optimization for joinbyname
+ if joinbyname:
+ rows_by_host = {}
+ for hostrow in hostrows:
+ site = hostrow["site"]
+ host = hostrow["name"]
+ rows_by_host[(site, host)] = hostrow
+
for hostrow in hostrows:
site = hostrow["site"]
host = hostrow["name"]
+ # In case of joinbyname we deal with aggregations that bare the
+ # name of one host, but might contain states of multiple hosts.
+ # status_info cannot be filled from one row in that case. We
+ # try to optimize by assuming that all data that we need is being
+ # displayed in the same view and the information thus being present
+ # in some of the other hostrows.
if joinbyname:
+ status_info = {}
aggrs = g_user_cache["aggregations_by_hostname"].get(host, [])
- status_info = None
+ # collect all the required host of all matching aggregations
+ for a in aggrs:
+ reqhosts = a[1]["reqhosts"]
+ for sitehost in reqhosts:
+ if sitehost not in rows_by_host:
+ # This one is missing. Darn. Cancel it.
+ status_info = None
+ break
+ else:
+ row = rows_by_host[sitehost]
+ status_info[sitehost] = [
+ row["state"],
+ row["plugin_output"],
+ row["services_with_info"] ]
+ if status_info == None:
+ break
else:
aggrs = g_user_cache["host_aggregations"].get((site, host), [])
status_info = { (site, host) : [
@@ -1781,6 +1820,7 @@ def singlehost_table(columns, add_headers, only_sites, limit, filters, joinbynam
return rows
+ log("* Assembled %d rows.\n" % len(rows))
return rows
Module: check_mk
Branch: master
Commit: f05905cf5717139f05704574f480a4bc7573867c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f05905cf571713…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 14 12:15:14 2013 +0100
FIX: fixed crash on host notification when contact had explicit services set
---
ChangeLog | 3 +++
modules/notify.py | 15 ++++++++-------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 163230d..ded6142 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -80,6 +80,9 @@
* ADD: wmic_processs: cpucores now being considered when calculating
user/kernel percentages. (thanks to William Baum)
+ Notifications:
+ * FIX: fixed crash on host notification when contact had explicit services set
+
Livestatus:
* FIX: possible crash with VERY long downtime comments
diff --git a/modules/notify.py b/modules/notify.py
index b0e5ab3..28c100c 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -432,14 +432,15 @@ def should_notify(context, entry):
if entry.get("only_services"):
servicedesc = context.get("SERVICEDESC")
if not servicedesc:
- notify_log(" - Skipping: limited to certain services, but this is a host notification")
- for s in entry["only_services"]:
- if re.match(s, servicedesc):
- break
+ notify_log(" - Proceed: limited to certain services, but this is a host notification")
else:
- notify_log(" - Skipping: service '%s' matches non of %s" % (
- servicedesc, ", ".join(entry["only_services"])))
- return False
+ for s in entry["only_services"]:
+ if re.match(s, servicedesc):
+ break
+ else:
+ notify_log(" - Skipping: service '%s' matches non of %s" % (
+ servicedesc, ", ".join(entry["only_services"])))
+ return False
# Check notification type
event, allowed_events = check_notification_type(context, entry["host_events"], entry["service_events"])
Module: check_mk
Branch: master
Commit: 2190bf3583763f19840cca91cc66fae1c8fdd2fd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2190bf3583763f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Mar 13 14:56:50 2013 +0100
Fixed ChangeLog
---
ChangeLog | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d2a2432..163230d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,9 +20,6 @@
* Added PNP tempate for check_disk_smb
* Dashboards can now be configured to be reloaded on resizing
(automatically adds width/height url parameters)
- * New filter for IP address of a host
- * Quicksearch: allow searching for complete IP addresses and IP
- address prefixes
Event Console:
* New rule feature: automatically delete event after actions
@@ -91,6 +88,9 @@
Multisite:
* FIX: Avoid duplicate "Services" button in host detail views
+ * New filter for IP address of a host
+ * Quicksearch: allow searching for complete IP addresses and IP
+ address prefixes
1.2.2b4:
Core: