Module: check_mk
Branch: master
Commit: e51f157f81c57aef73649ab690ab1c045644d5e1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e51f157f81c57a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 9 17:56:16 2017 +0100
4459 FIX BI aggregations: fixed bug where the attempt to inactive aggregations raised an exception
During the compilation, the BI Cache now checks whether the required aggregation is
still in the list of available and enabled aggregations.
Change-Id: Ifb831aef01a9e41f937de5b6fcb9c4479f2fdfdd
---
.werks/4459 | 11 +++++++++++
web/htdocs/bi.py | 60 ++++++++++++++++++++++++++++++++------------------------
2 files changed, 45 insertions(+), 26 deletions(-)
diff --git a/.werks/4459 b/.werks/4459
new file mode 100644
index 0000000..ed12f44
--- /dev/null
+++ b/.werks/4459
@@ -0,0 +1,11 @@
+Title: BI aggregations: fixed bug where the attempt to inactive aggregations raised an exception
+Level: 1
+Component: bi
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1489078329
+Class: fix
+
+During the compilation, the BI Cache now checks whether the required aggregation is
+still in the list of available and enabled aggregations.
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index d3e952c..0fc5e0b 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -319,22 +319,23 @@ class JobWorker(object):
log("Compiling aggregation %d/%d: %r with %d hosts" % (aggr_type, aggr_idx, groups, len(g_services_by_hostname)))
enabled_aggregations = get_enabled_aggregations()
+
+
# Check if the aggregation is still correct
if aggr_idx >= len(enabled_aggregations):
# aggregation mismatch... config might have changed
- log("Aggregation mismatch: Index error")
- return
+ raise MKConfigError("Aggregation mismatch: Index error")
aggr = enabled_aggregations[aggr_idx]
if aggr[0] != aggr_type:
- log("Aggregation type mismatch")
- return
+ raise MKConfigError("Aggregation type mismatch")
aggr = aggr[1]
aggr_groups = type(aggr[1]) == list and tuple(aggr[1]) or tuple([aggr[1]])
if groups != aggr_groups:
- log("Aggregation groups mismatch")
- return
+ raise MKConfigError("Aggregation groups mismatch")
+
+
aggr_options, aggr = aggr[0], aggr[1:]
use_hard_states = aggr_options.get("hard_states")
@@ -906,26 +907,33 @@ class BIJobManager(object):
# We do not want to alter the cached original
jobfile_data = copy.deepcopy(jobfile_data)
- # jobfile_data example
- # { "jobs":
- # # Single host aggregations
- # { (aggr_type, aggr_index, aggr_groups): { "queued_hosts": [], "compiled_hosts": [] },
- # # Multihost aggregation
- # (aggr_type, aggr_index, aggr_groups): { "included_hosts": [], "compiled": True } }
- for job, info in jobfile_data.get("jobs", {}).items():
- if job[0] == AGGR_HOST:
- # Reduce queued hosts by already compiled hosts
- if not discard_old_cache:
+ if discard_old_cache:
+ aggr_ids = get_aggr_ids([AGGR_HOST, AGGR_MULTI])
+ # Recompile everything mentioned in the jobs file and remove obsolete aggregations
+ for job, info in jobfile_data.get("jobs", {}).items():
+ if job in aggr_ids:
+ queued_jobs.append({ "id": job, "info": info })
+ else:
+ # jobfile_data example
+ # { "jobs":
+ # # Single host aggregations
+ # { (aggr_type, aggr_index, aggr_groups): { "queued_hosts": [], "compiled_hosts": [] },
+ # # Multihost aggregation
+ # (aggr_type, aggr_index, aggr_groups): { "included_hosts": [], "compiled": True } }
+ for job, info in jobfile_data.get("jobs", {}).items():
+ if job[0] == AGGR_HOST:
+ # Reduce queued hosts by already compiled hosts
info["queued_hosts"] -= info["compiled_hosts"]
- if not info.get("queued_hosts"):
- # Single host aggregation, no hosts in queue - GOOD!
- continue
- else:
- if not discard_old_cache and info.get("compiled") == True:
- # Fully compiled multi aggregation - GOOD!
- continue
+ if not info.get("queued_hosts"):
+ # Single host aggregation, no hosts in queue - GOOD!
+ continue
+ else:
+ if info.get("compiled") == True:
+ # Fully compiled multi aggregation - GOOD!
+ continue
+
+ queued_jobs.append( { "id": job, "info": info } )
- queued_jobs.append( { "id": job, "info": info } )
return queued_jobs
@@ -1059,8 +1067,8 @@ class BIJobManager(object):
if fully_compiled or error_info:
- g_bi_cache_manager.generate_cachefiles(is_fully_compiled = fully_compiled,
- error_info = error_info)
+ g_bi_cache_manager.generate_cachefiles(is_fully_compiled = fully_compiled,
+ error_info = error_info)
return True # Did compilation
Module: check_mk
Branch: master
Commit: 120970f55d003d94e559169402f1219efa37b181
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=120970f55d003d…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 9 16:09:39 2017 +0100
4458 FIX BI aggregations: Users with restricted host/services access no longer see "Not yet monitored" messages for unavailable hosts
Change-Id: Idd047a8e76770ff0b6843e1a2fb804dffd88c54c
---
.werks/4458 | 10 ++++++++++
web/htdocs/bi.py | 18 +++++++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/.werks/4458 b/.werks/4458
new file mode 100644
index 0000000..119ad7b
--- /dev/null
+++ b/.werks/4458
@@ -0,0 +1,10 @@
+Title: BI aggregations: Users with restricted host/services access no longer see "Not yet monitored" messages for unavailable hosts
+Level: 1
+Component: bi
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1489071952
+Class: fix
+
+
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index ca20a3c..d3e952c 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -2835,6 +2835,8 @@ def ajax_render_tree():
for tree in trees:
if tree["title"] == aggr_title:
row = create_aggregation_row(tree)
+ if row["aggr_state"]["state"] == None:
+ continue # Not yet monitored, aggregation is not displayed
row["aggr_group"] = aggr_group
# ZUTUN: omit_root, boxes, only_problems has HTML-Variablen
tdclass, htmlcode = render_tree_foldable(row, boxes=boxes, omit_root=omit_root,
@@ -3152,6 +3154,13 @@ def filter_tree_only_problems(tree):
def create_aggregation_row(tree, status_info = None):
tree_state = execute_tree(tree, status_info)
+
+ # TODO: the tree state may include hosts the current user has
+ # no access to. Reason: The BI aggregation is always compiled
+ # with full host/service access.
+ # To fix this properly we need a list of all hosts/services
+ # available to this user
+
state, assumed_state, node, subtrees = tree_state
eff_state = state
if assumed_state != None:
@@ -3233,6 +3242,9 @@ def table(columns, add_headers, only_sites, limit, filters):
continue
row = create_aggregation_row(tree)
+ if row["aggr_state"]["state"] == None:
+ continue # Not yet monitored, aggregation is not displayed
+
row["aggr_group"] = group
rows.append(row)
if not html.check_limit(rows, limit):
@@ -3369,7 +3381,11 @@ def singlehost_table(columns, add_headers, only_sites, limit, filters, joinbynam
this_row['services_with_fullstate'],
]
- row.update(create_aggregation_row(aggregation, status_info))
+ new_row = create_aggregation_row(aggregation, status_info)
+ if new_row["aggr_state"]["state"] == None:
+ continue # Not yet monitored, aggregation is not displayed
+
+ row.update(new_row)
row["aggr_group"] = group
rows.append(row)
if not html.check_limit(rows, limit):
Module: check_mk
Branch: master
Commit: 4d5253a6691e566b41665c0c8f929f77c1520f62
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4d5253a6691e56…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Thu Mar 9 15:29:56 2017 +0100
Added description to werk #4441 and help text to ruleset
Change-Id: I063df904298092918ef4a5f8373f5fca26b7892e
---
.werks/4441 | 17 ++++++++++++++++-
web/plugins/wato/check_parameters.py | 15 +++++++++++++--
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/.werks/4441 b/.werks/4441
index b207378..e8ebe12 100644
--- a/.werks/4441
+++ b/.werks/4441
@@ -1,4 +1,4 @@
-Title: mem: new configurable thresholds for "Avaiable memory"
+Title: mem: new configurable thresholds for "Estimated RAM for new processes"
Level: 1
Component: checks
Compatible: compat
@@ -7,4 +7,19 @@ Version: 1.5.0i1
Date: 1488458833
Class: feature
+Now thresholds for the graph "Estimated RAM for new processes" are
+configureable. This is optional and will use the "MemAvailable" value,
+which is part of meminfo since kernel version 3.14. This value will not be
+checked on older kernel versions and thresholds will not be used even if a
+rule has been set.
+From kernel.org:
+An estimate of how much memory is available for starting new
+applications, without swapping. Calculated from MemFree,
+SReclaimable, the size of the file LRU lists, and the low
+watermarks in each zone.
+The estimate takes into account that the system needs some
+page cache to function well, and that not all reclaimable
+slab will be reclaimable, due to items being in use. The
+impact of those factors will vary from system to system.
+(https://www.kernel.org/doc/Documentation/filesystems/proc.txt)
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 5e4cecb..090300f 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -7428,9 +7428,10 @@ def UpperMemoryLevels(what, default_percents=None, of_what=None):
]
)
-def LowerMemoryLevels(what, default_percents=None, of_what=None):
+def LowerMemoryLevels(what, default_percents=None, of_what=None, help_text=None):
return CascadingDropdown(
title = _("Lower levels for %s") % what,
+ help = help_text,
choices = [
( "perc_free", _("Percentual levels"), FreePercentage(default_percents, of_what) ),
( "abs_free", _("Absolute levels"), FreeSize() ),
@@ -7463,7 +7464,17 @@ register_check_parameters(
( "levels_writeback", UpperMemoryLevels(_("Disk Writeback"))),
( "levels_committed", UpperMemoryLevels(_("Committed memory"), (100.0, 150.0), _("RAM + Swap"))),
( "levels_commitlimit", LowerMemoryLevels(_("Commit Limit"), ( 20.0, 10.0), _("RAM + Swap"))),
- ( "levels_available", LowerMemoryLevels(_("RAM available"), ( 20.0, 10.0), _("RAM"))),
+ ( "levels_available", LowerMemoryLevels(_("Estimated RAM for new processes"), ( 20.0, 10.0), _("RAM"),
+ _("If the host has a kernel of version 3.14 or newer, the information MemAvailable is provided: "
+ "\"An estimate of how much memory is available for starting new "
+ "applications, without swapping. Calculated from MemFree, "
+ "SReclaimable, the size of the file LRU lists, and the low "
+ "watermarks in each zone. "
+ "The estimate takes into account that the system needs some "
+ "page cache to function well, and that not all reclaimable "
+ "slab will be reclaimable, due to items being in use. The "
+ "impact of those factors will vary from system to system.\" "
+ "(https://www.kernel.org/doc/Documentation/filesystems/proc.txt)"))),
( "levels_vmalloc", LowerMemoryLevels(_("Largest Free VMalloc Chunk"))),
( "handle_hw_corrupted_error", MonitoringState(
title = _("Handle Hardware Corrupted Error"),
Module: check_mk
Branch: master
Commit: 054ed7e8836509efdd1e288034909b0364f3f265
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=054ed7e8836509…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Thu Mar 9 15:33:21 2017 +0100
4443 FIX mem: Changed name from RAM available to Estimated RAM for new processes
The name "RAM available" has not been descriptive enough since it did not reflect the differenz between the regular free RAM calculation made by Check_MK. For differences and more information see werk #4441
Change-Id: I93ef01a0ef47d69e41b406fcbda4d446f27fc22b
---
.werks/4443 | 10 ++++++++++
web/plugins/metrics/check_mk.py | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/.werks/4443 b/.werks/4443
new file mode 100644
index 0000000..2528c50
--- /dev/null
+++ b/.werks/4443
@@ -0,0 +1,10 @@
+Title: mem: Changed name from RAM available to Estimated RAM for new processes
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1489069824
+Class: fix
+
+The name "RAM available" has not been descriptive enough since it did not reflect the differenz between the regular free RAM calculation made by Check_MK. For differences and more information see werk #4441
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index 04db695..47b4790 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -520,7 +520,7 @@ metric_info["mem_used"] = {
metric_info["mem_available"] = {
"color" : "21/a",
- "title" : _("RAM available"),
+ "title" : _("Estimated RAM for new processes"),
"unit" : "bytes",
}