Module: check_mk
Branch: master
Commit: ae5150b35be9d230e17aa6e6282e90157c1e4799
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ae5150b35be9d2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 4 11:16:27 2013 +0100
FIX: BI see_all permission is now working again
---
.bugs/825 | 7 +++++--
.bugs/826 | 7 +++++--
ChangeLog | 1 +
web/htdocs/bi.py | 5 ++++-
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/.bugs/825 b/.bugs/825
index c4339ac..868ddd2 100644
--- a/.bugs/825
+++ b/.bugs/825
@@ -1,8 +1,11 @@
Title: BI: See all Nagios objects seems not to work
Component: bi
-State: open
+Class: bug
+State: done
Date: 2013-01-24 17:44:29
Targetversion: 1.2.2
-Class: bug
See Ticket 793881
+
+2013-03-04 11:15:48: changed state open -> done
+Just fixed it.
diff --git a/.bugs/826 b/.bugs/826
index cb7d6de..a862a58 100644
--- a/.bugs/826
+++ b/.bugs/826
@@ -1,10 +1,13 @@
Title: function paint_aggr_tree_foldable is not defiened
Component: bi
-State: open
+Class: bug
+State: done
Date: 2013-02-01 11:33:32
Targetversion: 1.2.2
-Class: bug
View painter paint_aggr_tree_foldable is used:
web/plugins/views/bi.py: "paint" : lambda row: paint_aggr_tree_foldable(row, boxes = True, omit_root = True),
but nowhere defined
+
+2013-03-04 10:57:06: changed state open -> done
+already solved. This code does not exist anymore.
diff --git a/ChangeLog b/ChangeLog
index 5dffbad..074d8e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -98,6 +98,7 @@
* FIX: list of BI aggregates was incomplete in some cases
* FIX: single host aggregations didn't work for aggregations += [...]
* FIX: top-down and bottom-up was broken in case of "only problems"
+ * FIX: BI see_all permission is now working again
* Do not handle PENDING as "problem" anymore
* Make titles of non-leaf tree nodes klickable
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index a52b082..2439f1b 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -1111,10 +1111,12 @@ def get_status_info(required_hosts):
filter += "Filter: name = %s\n" % host
if len(hosts) > 1:
filter += "Or: %d\n" % len(hosts)
+ html.live.set_auth_domain('bi')
data = html.live.query(
"GET hosts\n"
"Columns: name state plugin_output services_with_info\n"
+ filter)
+ html.live.set_auth_domain('read')
tuples += [((site, e[0]), e[1:]) for e in data]
return dict(tuples)
@@ -1138,14 +1140,15 @@ def get_status_info_filtered(filter_header, only_sites, limit, add_columns, fetc
html.write('<div class="livestatus message" onmouseover="this.style.display=\'none\';">'
'<tt>%s</tt></div>\n' % (query.replace('\n', '<br>\n')))
-
html.live.set_only_sites(only_sites)
html.live.set_prepend_site(True)
+ html.live.set_auth_domain('bi')
data = html.live.query(query)
html.live.set_prepend_site(False)
html.live.set_only_sites(None)
+ html.live.set_auth_domain('read')
headers = [ "site" ] + columns
hostnames = [ row[1] for row in data ]
Module: check_mk
Branch: master
Commit: 114b818e4b0854affe822583533c00accb0b858d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=114b818e4b0854…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 4 12:11:07 2013 +0100
FIX: added checks wether or not a contactgroup can be deleted
---
.bugs/916 | 7 +++-
ChangeLog | 1 +
web/htdocs/wato.py | 76 +++++++++++++++++++++++++++++++++++++++++-----------
3 files changed, 66 insertions(+), 18 deletions(-)
diff --git a/.bugs/916 b/.bugs/916
index 7385abb..0985c70 100644
--- a/.bugs/916
+++ b/.bugs/916
@@ -1,9 +1,9 @@
Title: Contactgroup deletion does not affect rules / Rules break on next save
Component: wato
-State: open
+Class: bug
+State: done
Date: 2013-02-07 11:10:41
Targetversion: 1.2.2
-Class: bug
When having a contactgroup and a rule which assignes the group,
then deleting the group, the rule still points to the group.
@@ -12,3 +12,6 @@ When opening the edit dialog for that rule, the configured
value can not be selected anymore, since the value does not
exist in the dropdown field. The first element is selected
. When saving this rule it changes the value! this is bad.
+
+2013-03-04 12:06:07: changed state open -> done
+Added checks to find all places where this contactgroup could be referenced
diff --git a/ChangeLog b/ChangeLog
index 074d8e2..9a3fd1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -86,6 +86,7 @@
* FIX: stop doing snapin refreshes after they have been removed
* FIX: sidebar snapins which refresh do not register for restart detection anymore
* FIX: fix user database corruption in case of a race condition
+ * FIX: added checks wether or not a contactgroup can be deleted
* Changed sidebar snapin reload to a global interval (option:
sidebar_update_interval), defaults to 30 seconds
* Sidebar snapins are now bulk updated with one HTTP request each interval
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 4e6c116..9ff16fa 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -5647,6 +5647,57 @@ def save_configuration_vars(vars, filename):
# | Mode for editing host-, service- and contact groups |
# '----------------------------------------------------------------------'
+# Check if a group is currently in use and cannot be deleted
+# Returns a list of occurrances.
+# Possible usages:
+# - 1. rules: host to contactgroups, services to contactgroups
+# - 2. user memberships
+def find_usage_of_contact_groups(name):
+ # Part 1: Rules
+ used_in = []
+ rulesets = load_all_rulesets()
+ for varname in [ 'host_contactgroups', 'service_contactgroups' ]:
+ ruleset = rulesets[varname]
+ rulespec = g_rulespecs[varname]
+ for folder, rule in ruleset:
+ value, tag_specs, host_list, item_list, rule_options = parse_rule(rulespec, rule)
+ if value == name:
+ used_in.append(("%s: %s" % (_("Ruleset"), g_rulespecs[varname]["title"]),
+ make_link([("mode", "edit_ruleset"), ("varname", varname)])))
+
+ # Is the contactgroup assigned to a user?
+ users = filter_hidden_users(userdb.load_users())
+ entries = users.items()
+ entries.sort(cmp = lambda a, b: cmp(a[1].get("alias"), b[1].get("alias")))
+ for userid, user in entries:
+ cgs = user.get("contactgroups", [])
+ if name in cgs:
+ used_in.append(('%s: %s' % (_('User'), user.get('alias')),
+ make_link([('mode', 'edit_user'), ('edit', userid)])))
+
+ global_config = load_configuration_settings()
+
+ # Used in default_user_profile?
+ domain, valuespec, need_restart, allow_reset = g_configvars['default_user_profile']
+ configured = global_config.get('default_user_profile', {})
+ default_value = valuespec.default_value()
+ if (configured and name in configured['contactgroups']) \
+ or name in default_value['contactgroups']:
+ used_in.append(('%s' % (_('Default User Profile')),
+ make_link([('mode', 'edit_configvar'), ('varname', 'default_user_profile')])))
+
+ # Is the contactgroup used in mkeventd notify (if available)?
+ if 'mkeventd_notify_contactgroup' in g_configvars:
+ domain, valuespec, need_restart, allow_reset = g_configvars['mkeventd_notify_contactgroup']
+ configured = global_config.get('mkeventd_notify_contactgroup')
+ default_value = valuespec.default_value()
+ if (configured and name == configured) \
+ or name == default_value:
+ used_in.append(('%s' % (valuespec.title()),
+ make_link([('mode', 'edit_configvar'), ('varname', 'mkeventd_notify_contactgroup')])))
+
+ return used_in
+
def mode_groups(phase, what):
if what == "host":
what_name = _("host groups")
@@ -5676,22 +5727,15 @@ def mode_groups(phase, what):
delname = html.var("_delete")
if what == 'contact':
- # Is the contactgroup in use?
- member_links = []
- users = filter_hidden_users(userdb.load_users())
- entries = users.items()
- entries.sort(cmp = lambda a, b: cmp(a[1].get("alias"), b[1].get("alias")))
- for id, user in entries:
- cgs = user.get("contactgroups", [])
- if delname in cgs:
- member_links.append('<a href="%s">%s</a>' %
- (make_link([('mode', 'edit_user'), ('edit', id)]), user.get('alias')))
-
- if member_links:
- raise MKUserError(None,
- _('Unable to delete the group %s. It still has the following members: %s. '
- ' You must first remove all members from the group to be able to delete the group.') %
- (delname, ', '.join(member_links)))
+ usages = find_usage_of_contact_groups(delname)
+ if usages:
+ message = "<b>%s</b><br>%s:<ul>" % \
+ (_("You cannot delete this contactgroup."),
+ _("It is still in use by"))
+ for title, link in usages:
+ message += '<li><a href="%s">%s</a></li>\n' % (link, title)
+ message += "</ul>"
+ raise MKUserError(None, message)
confirm_txt = _('Do you really want to delete the %s group %s?') % (what, delname)
else:
Module: check_mk
Branch: master
Commit: 13a80c774207934b52e612e533cf9884ce1fdfa3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=13a80c77420793…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Mar 4 19:09:25 2013 +0100
WATO: Fix localization of rule options
---
ChangeLog | 1 +
web/htdocs/wato.py | 69 ++++++++++++++++++++++++++-------------------------
2 files changed, 36 insertions(+), 34 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a740f57..3824518 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -109,6 +109,7 @@
* FIX: Alias values of host/service/contact groups need to be set and unique
within the group
* FIX: Fixed exception when editing contactgroups without alias
+ * FIX: Fix localization of rule options
* Suggest use default value for filesystem levels that make sense
* Valuespec: CascadingDropdown now able to process choice values from functions
* Freshness checking for classical passive Nagios checks (custom_checks)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index c02a1ea..de512db 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -9427,40 +9427,6 @@ def change_host_tags_in_rules(folder, operations, mode):
# | from main.mk. |
# '----------------------------------------------------------------------'
-vs_rule_options = Dictionary(
- title = _("Additional options"),
- optional_keys = False,
- render = "form",
- elements = [
- ( "comment",
- TextUnicode(
- title = _("Comment"),
- help = _("An optional comment that helps you documenting the purpose of "
- "this rule"),
- size = 80,
- attrencode = True,
- )
- ),
- ( "docu_url",
- TextAscii(
- title = _("Documentation-URL"),
- help = _("An optional URL pointing to documentation or any other page. This will be displayed "
- "as an icon <img class=icon src='images/button_url_lo.png'> and open a new page when clicked. "
- "You can use either global URLs (beginning with <tt>http://</tt>), absolute local urls "
- "(beginning with <tt>/</tt>) or relative URLs (that are relative to <tt>check_mk/</tt>)."),
- size = 80,
- ),
- ),
- ( "disabled",
- Checkbox(
- title = _("Rule activation"),
- help = _("Disabled rules are kept in the configuration but are not applied."),
- label = _("do not apply this rule"),
- )
- ),
- ]
-)
-
def mode_ruleeditor(phase):
only_host = html.var("host", "")
only_local = "" # html.var("local")
@@ -10267,6 +10233,41 @@ def get_rule_conditions(ruleset):
def mode_edit_rule(phase, new = False):
+ # Due to localization this cannot be defined in the global context!
+ vs_rule_options = Dictionary(
+ title = _("Additional options"),
+ optional_keys = False,
+ render = "form",
+ elements = [
+ ( "comment",
+ TextUnicode(
+ title = _("Comment"),
+ help = _("An optional comment that helps you documenting the purpose of "
+ "this rule"),
+ size = 80,
+ attrencode = True,
+ )
+ ),
+ ( "docu_url",
+ TextAscii(
+ title = _("Documentation-URL"),
+ help = _("An optional URL pointing to documentation or any other page. This will be displayed "
+ "as an icon <img class=icon src='images/button_url_lo.png'> and open a new page when clicked. "
+ "You can use either global URLs (beginning with <tt>http://</tt>), absolute local urls "
+ "(beginning with <tt>/</tt>) or relative URLs (that are relative to <tt>check_mk/</tt>)."),
+ size = 80,
+ ),
+ ),
+ ( "disabled",
+ Checkbox(
+ title = _("Rule activation"),
+ help = _("Disabled rules are kept in the configuration but are not applied."),
+ label = _("do not apply this rule"),
+ )
+ ),
+ ]
+ )
+
varname = html.var("varname")
rulespec = g_rulespecs[varname]
Module: check_mk
Branch: master
Commit: ad11ff1383444b9b3119eadd2bcc64b9e9caac6a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ad11ff1383444b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Mar 4 16:40:33 2013 +0100
mounts: ignore multiple occurrances of the same device
---
ChangeLog | 1 +
checks/mounts | 4 +++-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 83f8560..a740f57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,7 @@
new param average: average the values over the given minute
new param post can now be configured via int and float, now
supports percentage values
+ * mounts: ignore multiple occurrances of the same device
Livestatus:
* Table statehist: Improved detection of vanished hosts and services.
diff --git a/checks/mounts b/checks/mounts
index 46eca5c..1fa7cc6 100644
--- a/checks/mounts
+++ b/checks/mounts
@@ -26,8 +26,10 @@
def inventory_mounts(info):
inventory = []
+ devices = []
for dev, mp, fstype, options, dump, fsck in info:
- if fstype not in [ 'tmpfs' ]:
+ if fstype not in [ 'tmpfs' ] and dev not in devices:
+ devices.append(dev)
opts = options.split(",")
opts.sort()
inventory.append( (mp, opts) )