Module: check_mk
Branch: master
Commit: d70a053bf98aa2f5ca755fb1d377e6ac43b64059
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d70a053bf98aa2…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jan 2 18:01:10 2012 +0100
Multisite: enable sounds per default now
---
.bugs/342 | 10 ++++++++--
ChangeLog | 3 +++
multisite.mk | 19 ++++++++-----------
web/htdocs/config.py | 10 +++++++++-
web/htdocs/views.py | 4 +++-
web/plugins/wato/check_mk_configuration.py | 11 +++++++++++
6 files changed, 42 insertions(+), 15 deletions(-)
diff --git a/.bugs/342 b/.bugs/342
index c90f26c..72d1a45 100644
--- a/.bugs/342
+++ b/.bugs/342
@@ -1,12 +1,18 @@
Title: Enable sounds per default
Component: multisite
+State: done
+Class: cleanup
Benefit: 1
-State: open
Cost: 2
Date: 2011-08-24 16:32:16
-Class: cleanup
Targetversion: 1.2.0
Enable the sound configuration in config.py per default. Change
the comments in the example multisite.mk or remove that part
completely. Update the documentation.
+
+2012-01-02 17:58:11: changed state open -> done
+Sounds are now enabled per default. And I've made a new
+configuration variable enable_sounds which only must be
+set to False in order to disable them. The list config.sounds is
+preset to useful defaults.
diff --git a/ChangeLog b/ChangeLog
index 4a1e381..dcf341d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,9 @@
Multisite:
* Improve transaction handling and reload detection: user can have
multiple action threads in parallel now
+ * Sounds in views are now enabled per default. The new configuration
+ variable enable_sounds can be set to False in multisite.mk in order
+ to disable sounds.
1.1.13i2:
Core, Setup, etc.:
diff --git a/multisite.mk b/multisite.mk
index cbf5282..95d285e 100644
--- a/multisite.mk
+++ b/multisite.mk
@@ -12,11 +12,14 @@ admin_users = [ "nagiosadmin" ]
nagvis_base_url = '/nagvis'
# Views allow to play alarm sounds according to the
-# "worst" state of the show items. Configure here
-# which sounds to play. Possible events: critical,
-# warning, unknown, ok, up, down, unreachable,
-# pending. Sounds are expected in the sounds subdirectory
-# of htdocs (Default is /usr/share/check_mk/web/htdocs/sounds)
+# "worst" state of the shown items. Enable sounds here:
+# enable_sounds = True
+
+# You can configure here which sounds to play. Possible events are "critical",
+# "warning", "unknown", "ok", "up",
"down", "unreachable" and
+# "pending". Sounds are expected in the sounds subdirectory
+# of htdocs (Default is /usr/share/check_mk/web/htdocs/sounds). The
+# following setting is the default:
# sounds = [
# ( "down", "down.wav" ),
# ( "critical", "critical.wav" ),
@@ -24,12 +27,6 @@ nagvis_base_url = '/nagvis'
# ( "warning", "warning.wav" ),
# ( None, "ok.wav" ),
# ]
-# Note: this example has not sound for unreachable hosts.
-# set sound_url to another url, if you place your sound
-# files elsewhere:
-# sound_url = "http://otherhost/path/to/sound/"
-# or
-# sound_url = "/nagios/alarms/"
# Tabs for choosing number of columns refresh
# view_option_refreshes = [ 30, 60, 90, 0 ]
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index 347bb04..9283855 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -475,7 +475,15 @@ declare_permission("ignore_hard_limit",
#
sound_url = "sounds/"
-sounds = []
+enable_sounds = False
+sounds = [
+ ( "down", "down.wav" ),
+ ( "critical", "critical.wav" ),
+ ( "unknown", "unknown.wav" ),
+ ( "warning", "warning.wav" ),
+ ( None, "ok.wav" ),
+]
+
# __ ___ _ _
# \ \ / (_) _____ __ ___ _ __ | |_(_) ___ _ __ ___
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index a75e902..85382d1 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1577,8 +1577,10 @@ def do_table_join(master_ds, master_rows, master_filters,
join_painters, join_co
row["JOIN"] = joininfo
-
def play_alarm_sounds():
+ if not config.enable_sounds:
+ return
+
url = config.sound_url
if not url.endswith("/"):
url += "/"
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 78caade..0066e42 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -71,6 +71,17 @@ register_configvar(group,
domain = "multisite")
register_configvar(group,
+ "enable_sounds",
+ Checkbox(title = _("Enabled sounds in views"),
+ label = _("enable sounds"),
+ help = _("If sounds are enabled then the user will be alarmed by
problems shown "
+ "in a Multisite status view if that view has been configured
for sounds. "
+ "From the views shipped in with Multisite all problem views
have sounds "
+ "enabled."),
+ default_value = True),
+ domain = "multisite")
+
+register_configvar(group,
"context_buttons_to_show",
Optional(
Integer(