Module: check_mk
Branch: master
Commit: 1edae8759c5c5691e80d91db4556336be0acb67b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1edae8759c5c56…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 16 09:23:11 2018 +0100
5732 BI aggregations are now customer aware
The configuration if the BI aggregations is now handled in a customer aware
way by the Check_MK Managed Services Edition. You can now configure each
aggregation to be associated with a customer, the provider or being globally
available. The aggregations are assigned to the provider by default.
In case you want to have an aggregation only be synchronized to a single
customer, you can configure it in the aggregation properties.
A customer only get's the BI packs and BI rules synchronized that are
needed to handle the aggregations that are made available to this customer.
Change-Id: If3ef6664da55524ce11ae8d1fe5f00fe0f1ba179
---
.werks/5732 | 19 ++++++++++
web/plugins/wato/bi.py | 101 +++++++++++++++++++++++++++++++------------------
2 files changed, 83 insertions(+), 37 deletions(-)
diff --git a/.werks/5732 b/.werks/5732
new file mode 100644
index 0000000..0c70b1b
--- /dev/null
+++ b/.werks/5732
@@ -0,0 +1,19 @@
+Title: BI aggregations are now customer aware
+Level: 2
+Component: wato
+Compatible: compat
+Edition: cme
+Version: 1.5.0i3
+Date: 1518733322
+Class: feature
+
+The configuration if the BI aggregations is now handled in a customer aware
+way by the Check_MK Managed Services Edition. You can now configure each
+aggregation to be associated with a customer, the provider or being globally
+available. The aggregations are assigned to the provider by default.
+
+In case you want to have an aggregation only be synchronized to a single
+customer, you can configure it in the aggregation properties.
+
+A customer only get's the BI packs and BI rules synchronized that are
+needed to handle the aggregations that are made available to this customer.
diff --git a/web/plugins/wato/bi.py b/web/plugins/wato/bi.py
index d6cafce..dc8013a 100644
--- a/web/plugins/wato/bi.py
+++ b/web/plugins/wato/bi.py
@@ -26,6 +26,7 @@
# WATO-Module for the rules and aggregations of Check_MK BI
+import managed
import table
# .--Base class----------------------------------------------------------.
@@ -98,6 +99,7 @@ class ModeBI(WatoMode):
# .--------------------------------------------------------------------.
# | Loading and saving |
# '--------------------------------------------------------------------'
+
def _load_config(self):
filename = multisite_dir + "bi.mk"
try:
@@ -156,14 +158,19 @@ class ModeBI(WatoMode):
def save_config(self):
+ output = self.generate_bi_config_file_content(self._packs)
+ make_nagios_directory(multisite_dir)
+ store.save_file(multisite_dir + "bi.mk", output)
+
+
+
+ def generate_bi_config_file_content(self, packs):
output = watolib.wato_fileheader()
- for pack_id, pack in sorted(self._packs.items()):
+ for pack_id, pack in sorted(packs.items()):
converted_pack = self._convert_pack_to_bi(pack)
output += "bi_packs[%r] = %s\n\n" % (
pack_id, self._replace_bi_constants(pprint.pformat(converted_pack, width=50)))
-
- make_nagios_directory(multisite_dir)
- store.save_file(multisite_dir + "bi.mk", output)
+ return output
def _convert_pack_to_bi(self, pack):
@@ -206,12 +213,19 @@ class ModeBI(WatoMode):
node = self._convert_node_to_bi(aggr["node"])
convaggr = conv + node
+ option_keys = [
+ ("hard_states", False),
+ ("downtime_aggr_warn", False),
+ ("disabled", False),
+ ]
+
+ if cmk.is_managed_edition():
+ option_keys.append(("customer", managed.default_customer_id()))
+
# Create dict with all aggregation options
options = {}
- for option in ["hard_states",
- "downtime_aggr_warn",
- "disabled"]:
- options[option] = aggr.get(option, False)
+ for option, default_value in option_keys:
+ options[option] = aggr.get(option, default_value)
convaggr = (options,) + convaggr
return convaggr
@@ -374,11 +388,13 @@ class ModeBI(WatoMode):
return ("foreach_host", (what, tags, hostspec, subnode))
-
def _add_change(self, action_name, text):
add_change(action_name, text, domains=[watolib.ConfigDomainGUI], sites=config.get_login_sites())
+ def get_packs(self):
+ return self._packs
+
# .--------------------------------------------------------------------.
# | Valuespecs |
# '--------------------------------------------------------------------'
@@ -644,11 +660,16 @@ class ModeBI(WatoMode):
def _get_vs_aggregation(self):
+ if cmk.is_managed_edition():
+ cme_elements = managed.customer_choice_element()
+ else:
+ cme_elements = []
+
return Dictionary(
title = _("Aggregation Properties"),
optional_keys = False,
render = "form",
- elements = [
+ elements = cme_elements + [
( "groups",
ListOfStrings(
title = _("Aggregation Groups"),
@@ -816,6 +837,33 @@ class ModeBI(WatoMode):
sub_rule_ids.append(r[0])
return sub_rule_ids
+
+ def find_aggregation_rule_usages(self):
+ aggregations_that_use_rule = {}
+ for pack_id, pack in self._packs.items():
+ for aggr_id, aggregation in enumerate(pack["aggregations"]):
+ rule_id, description = self.rule_called_by_node(aggregation["node"])
+ aggregations_that_use_rule.setdefault(rule_id, []).append((aggr_id, aggregation))
+ sub_rule_ids = self._aggregation_recursive_sub_rule_ids(rule_id)
+ for sub_rule_id in sub_rule_ids:
+ aggregations_that_use_rule.setdefault(sub_rule_id, []).append((aggr_id, aggregation))
+ return aggregations_that_use_rule
+
+
+ def _aggregation_recursive_sub_rule_ids(self, ruleid):
+ rule = self.find_rule_by_id(ruleid)
+ if not rule:
+ return []
+
+ sub_rule_ids = self.aggregation_sub_rule_ids(rule)
+ if not sub_rule_ids:
+ return []
+
+ result = sub_rule_ids[:]
+ for sub_rule_id in sub_rule_ids:
+ result += self._aggregation_recursive_sub_rule_ids(sub_rule_id)
+ return result
+
# .--------------------------------------------------------------------.
# | Generic rendering |
# '--------------------------------------------------------------------'
@@ -1164,6 +1212,12 @@ class ModeBIAggregations(ModeBI):
html.icon_button(delete_url, _("Delete this aggregation"), "delete")
table.text_cell(_("Nr."), aggregation_id+1, css="number")
+
+ if cmk.is_managed_edition():
+ table.text_cell(_("Customer"))
+ if "customer" in aggregation:
+ html.write_text(managed.get_customer_name(aggregation))
+
table.text_cell("", css="buttons")
if aggregation["disabled"]:
@@ -1415,33 +1469,6 @@ class ModeBIRules(ModeBI):
table.end()
- def find_aggregation_rule_usages(self):
- aggregations_that_use_rule = {}
- for pack_id, pack in self._packs.items():
- for aggr_id, aggregation in enumerate(pack["aggregations"]):
- rule_id, description = self.rule_called_by_node(aggregation["node"])
- aggregations_that_use_rule.setdefault(rule_id, []).append((aggr_id, aggregation))
- sub_rule_ids = self._aggregation_recursive_sub_rule_ids(rule_id)
- for sub_rule_id in sub_rule_ids:
- aggregations_that_use_rule.setdefault(sub_rule_id, []).append((aggr_id, aggregation))
- return aggregations_that_use_rule
-
-
- def _aggregation_recursive_sub_rule_ids(self, ruleid):
- rule = self.find_rule_by_id(ruleid)
- if not rule:
- return []
-
- sub_rule_ids = self.aggregation_sub_rule_ids(rule)
- if not sub_rule_ids:
- return []
-
- result = sub_rule_ids[:]
- for sub_rule_id in sub_rule_ids:
- result += self._aggregation_recursive_sub_rule_ids(sub_rule_id)
- return result
-
-
#.
# .--Rule Tree-----------------------------------------------------------.
Module: check_mk
Branch: master
Commit: 7e706feb537c9a9609618e190dd11a57be54d3e7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7e706feb537c9a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Feb 15 16:35:38 2018 +0100
5731 Custom icons and actions: Add new macro $USER_ID$
The macro <tt>$USER_ID</tt> has been added to the replacement mechanic of
"Custom icons and actions" URL. This macro is replaced with the ID of the
user that is currently working with the GUI.
Change-Id: Id2042fef1d2151cdbfb3c260438460d43df9a188
---
.werks/5731 | 12 ++++++++++++
web/plugins/views/painters.py | 2 ++
web/plugins/wato/check_mk_configuration.py | 1 +
3 files changed, 15 insertions(+)
diff --git a/.werks/5731 b/.werks/5731
new file mode 100644
index 0000000..7488510
--- /dev/null
+++ b/.werks/5731
@@ -0,0 +1,12 @@
+Title: Custom icons and actions: Add new macro $USER_ID$
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.5.0i3
+Date: 1518708871
+Class: feature
+
+The macro <tt>$USER_ID</tt> has been added to the replacement mechanic of
+"Custom icons and actions" URL. This macro is replaced with the ID of the
+user that is currently working with the GUI.
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index ab13d8a..5aee065 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -67,6 +67,7 @@ import copy
import bi # Needed for BI Icon. For arkane reasons (ask htdocs/module.py) this
# cannot be imported in views.py directly.
+import config
import cmk.paths
import cmk.man_pages as man_pages
@@ -391,6 +392,7 @@ def replace_action_url_macros(url, what, row):
macros = {
"HOSTNAME" : row['host_name'],
"HOSTADDRESS" : row['host_address'],
+ "USER_ID" : config.user.id,
}
if what == 'service':
macros.update({
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index 468e61b..091396b 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -653,6 +653,7 @@ register_configvar(group,
'<li>$SERVICEDESC_URL_ENCODED$: Same as above but URL encoded</li>'
'<li>$HOSTADDRESS$: Contains the network address of the host</li>'
'<li>$HOSTADDRESS_URL_ENCODED$: Same as above but URL encoded</li>'
+ '<li>$USER_ID$: The user ID of the currently active user</li>'
'</ul>'),
size = 80,
),
Module: check_mk
Branch: master
Commit: 4d331f47882677f78003144b7487e125f1b12112
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4d331f47882677…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Thu Feb 15 14:54:16 2018 +0100
Windows agent: add perf counter name to example ini
Add an example how to use the name of the performance counter instead of
its start index:
[winperf]
counters = Terminal Services:ts_sessions
---
agents/windows/check_mk.example.ini | 3 +++
1 file changed, 3 insertions(+)
diff --git a/agents/windows/check_mk.example.ini b/agents/windows/check_mk.example.ini
index 05172a8..5cd1905 100644
--- a/agents/windows/check_mk.example.ini
+++ b/agents/windows/check_mk.example.ini
@@ -76,6 +76,9 @@
# counters = 10332:msx_queues
# counters = 638:tcp_conn
+ # Instead of specifying the counter start index, the name of the performance
+ # counter can be used.
+ # counters = Terminal Services:ts_sessions
[logfiles]
# # Define textfiles to be monitored, separated by |
Module: check_mk
Branch: master
Commit: bb04f67452ecf920712cdd1d1041b0dc686ff35a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bb04f67452ecf9…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Feb 15 13:57:59 2018 +0100
Polish werk HTML a bit.
Change-Id: If25568cff08120fcd981b47764e9e03ad735b17b
---
.werks/5671 | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/.werks/5671 b/.werks/5671
index cf0df46..1b07eb1 100644
--- a/.werks/5671
+++ b/.werks/5671
@@ -10,7 +10,7 @@ Class: feature
Livestatus offers various places where a regular expression can be used, e.g. in
its "Filter:" header for GET queries. The previous implementation had various
problems, which have all been fixed by switching to a new regular expression
-engine (RE2, see https://github.com/google/re2):
+engine <a href="https://github.com/google/re2">RE2</a>:
<ul>
<li>Unicode was not handled correctly: RE2 fully understands UTF-8, so this has
@@ -29,13 +29,15 @@ and the input, so this has been fixed, too.</li>
As an additional bonus, most of the time RE2 is quite a bit faster than the
previous implementation.
-RE2's regular expression syntax (https://github.com/google/re2/wiki/Syntax) is
-basically a superset of the previous POSIX extended regular expression syntax
-(http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04),
+RE2's regular expression <a
+href="https://github.com/google/re2/wiki/Syntax">syntax</a> is basically a
+superset of the previous POSIX extended regular expression <a
+href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag…">syntax</a>,
so you won't have to change your patterns.
-Note that one esoteric detail is different, though, namely the semantics of
-submatching (see https://swtch.com/~rsc/regexp/regexp2.html#posix). If you
-relied on this, you probably already had some problems, because almost every
-POSIX regex implementation out there was buggy in some way (see
-https://wiki.haskell.org/Regex_Posix#Results_and_Bugs).
+Note that one esoteric detail is different, though, namely the <a
+href="https://swtch.com/~rsc/regexp/regexp2.html#posix">semantics of
+submatching</a>. If you relied on this, you probably already had some problems,
+because almost every POSIX regex implementation out there was <a
+href="https://wiki.haskell.org/Regex_Posix#Results_and_Bugs">buggy</a> in some
+way.