Module: check_mk
Branch: master
Commit: dd604222bb9e1ac1429935b6a7645a4276e14536
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dd604222bb9e1a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 17 15:19:50 2013 +0100
Added FOREACH_SERVICE capability to leaf nodes
---
.bugs/785 | 16 ++++++++++++++--
ChangeLog | 3 +++
web/htdocs/bi.py | 6 +++++-
3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/.bugs/785 b/.bugs/785
index 07683d9..8f28356 100644
--- a/.bugs/785
+++ b/.bugs/785
@@ -1,9 +1,9 @@
Title: FOREACH_SERVICE in a leaf node does not work for direct host/services
Component: bi
-State: open
+Class: bug
+State: done
Date: 2012-07-26 16:05:16
Targetversion: 1.2.2
-Class: bug
If you use FOREACH_SERVICE within an inner node then you cannot
directly add leaf nodes. The following produces an error:
@@ -14,3 +14,15 @@ aggregation_rules[...] = (
( FOREACH_SERVICE, ALL_HOSTS, ".*", "$1$", HOST_STATE ),
]
)
+
+2013-01-17 15:19:06: changed state open -> done
+1. added FOREACH_SERVICE for leaf nodes
+2. the following works for me now:
+
+(FOREACH_SERVICE, "localhost", "fs_(.*)", "filesystem", [
"localhost", "$1$" ] ),
+(FOREACH_SERVICE, "localhost", "fs_(.*)", "localhost",
"fs_$1$"),
+(FOREACH_SERVICE, "localhost", "fs_(.*)", "localhost",
"fs_$1$" ),
+(FOREACH_SERVICE, "localhost", "fs_(.*)", "localhost",
HOST_STATE ),
+(FOREACH_SERVICE, "(.*)", "fs_(.*)", "$1$", HOST_STATE ),
+
+Some of the rules are senseless but should work in general.
diff --git a/ChangeLog b/ChangeLog
index 86173bb..dc1685a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,9 @@
* FIX: Fixed displaying of tag selections when creating a rule in the ruleeditor
* FIX: Rulesets are always cloned in the same folder
+ BI:
+ * Added FOREACH_SERVICE capability to leaf nodes
+
1.2.1i4:
Core:
* Better exception handling when executing "Check_MK"-Check. Printing
python
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index c8b5c16..ad13490 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -736,7 +736,11 @@ def compile_aggregation_rule(aggr_type, rule, args, lvl):
new_elements = new_new_elements
elif type(node[-1]) != list:
- if node[0] in [ config.FOREACH_HOST, config.FOREACH_CHILD,
config.FOREACH_PARENT ]:
+ if node[0] in [
+ config.FOREACH_HOST,
+ config.FOREACH_CHILD,
+ config.FOREACH_PARENT,
+ config.FOREACH_SERVICE ]:
# Handle case that leaf elements also need to be iterable via
FOREACH_HOST
# 1: config.FOREACH_HOST
# 2: (['waage'], '(.*)')