Module: check_mk
Branch: master
Commit: a20fc1e2b603de72abc28832ec0ce9443e04f9d0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a20fc1e2b603de…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jan 31 17:04:06 2012 +0100
mounts: fix python exception
---
checks/mounts | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/checks/mounts b/checks/mounts
index 5764cbe..54a7f4f 100644
--- a/checks/mounts
+++ b/checks/mounts
@@ -38,13 +38,15 @@ def check_mounts(item, targetopts, info):
if item == mp:
opts = options.split(",")
# Now compute the exact difference.
+
exceeding = []
- missing = []
for o in opts:
if o not in targetopts and not o.startswith("commit="):
exceeding.append(o)
- for o in targetopts and not o.startswith("commit="):
- if o not in opts:
+
+ missing = []
+ for o in targetopts:
+ if o not in opts and not o.startswith("commit="):
missing.append(o)
if not missing and not exceeding:
Module: check_mk
Branch: master
Commit: e0fd0f8aa93b2589a4d2a0cb7b35c560d1803c2f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e0fd0f8aa93b25…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jan 31 17:02:43 2012 +0100
WATO: added rule for clustered services
---
ChangeLog | 1 +
web/plugins/wato/check_mk_configuration.py | 11 +++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f041226..9993133 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -91,6 +91,7 @@
* Replication: Can now handle replication sites which use the form based auth
* Replication: Added option to ignore problems with the ssl certificates
used in ssl secured replications
+ * WATO now supports configuring Check_MK clusters
* FIX: Fixed missing folders in "move to" dropdown fields
* FIX: Fixed "move to target folders" after CSV import
* FIX: Fixed problem with duplicate extra_buttons when using the i18n of multiisite
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index 9430add..16239a9 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -707,6 +707,17 @@ register_rule(group,
"installed."),
))
+register_rule(group,
+ "clustered_services",
+ title = _("Clustered services"),
+ help = _("When you define HA clusters in WATO then you also have to specify "
+ "which services of a node should be assigned to the cluster and "
+ "which services to the physical node. This is done by this ruleset. "
+ "Please note that the rule will be applied to the <i>nodes</i>, not "
+ "to the cluster.<br><br>Please make sure that you re-inventorize the "
+ "cluster and the physical nodes after changing this ruleset."),
+ itemtype = "service")
+
group = _("SNMP")
Module: check_mk
Branch: master
Commit: e260539e51ad833fa41b059f3f99b9cec745cd44
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e260539e51ad83…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 31 16:20:02 2012 +0100
WATO Foldertree snapin links now to the views selected in the snapin
---
ChangeLog | 1 +
web/htdocs/js/sidebar.js | 52 ++++++++++++++++++++++++++++-------
web/plugins/pages/wato.py | 1 +
web/plugins/sidebar/shipped.py | 55 ++++++++++++++++++++++++-------------
web/plugins/sidebar/wato.py | 58 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 137 insertions(+), 30 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ce1bd0d..994b3af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -60,6 +60,7 @@
* Replaced "wato" sidebar snapin which mixed up WATO and status GUIs with
the new "wato_foldertree" snapin which only links to the status views
filtered by the WATO folder.
+ * Added "Dashboard" section to views snapin which shows a list of all dashboards
* FIX: Fixed auth problem when following logwatch icon links while using
the form based auth
* FIX: Fix problem with Umlaut in contact alias
diff --git a/web/htdocs/js/sidebar.js b/web/htdocs/js/sidebar.js
index 6829fe2..f5a3065 100644
--- a/web/htdocs/js/sidebar.js
+++ b/web/htdocs/js/sidebar.js
@@ -733,20 +733,50 @@ function storeScrollPos() {
/* Foldable Tree in snapin */
function wato_tree_click(folderpath) {
- // Get the URL in the main frame. If that is a view or a dashboard,
- // then reload that view with an updated "filename" variable. If that is
- // a wato.py page, navigate to the according wato page. In all other
- // cases, select the view "allhosts" with the according path.
- var href = parent.frames[1].location + ""; // adding "" converts url from something magic to string
- if (href.indexOf("/view.py") >= 0)
- href = add_html_var(href, "wato_folder", folderpath);
- else if (href.indexOf("/dashboard.py") >= 0)
- href = add_html_var(href, "wato_folder", folderpath);
- else
- href = "view.py?view_name=allhosts&wato_folder=" + escape(folderpath);
+ var topic = document.getElementById('topic').value;
+ var target = document.getElementById('target_' + topic).value;
+
+ if(target.substr(0, 9) == 'dashboard') {
+ dashboard_name = target.substr(9, target.length);
+ href = 'dashboard.py?name=' + escape(dashboard_name);
+ } else {
+ href = 'view.py?view_name=' + escape(target);
+ }
+
+ href += '&wato_folder=' + escape(folderpath);
+
parent.frames[1].location = href;
}
+function wato_tree_topic_changed(topic_field) {
+ // First toggle the topic dropdown field
+ var topic = topic_field.value;
+
+ // Hide all select fields but the wanted one
+ var select_fields = document.getElementsByTagName('select');
+ for(var i = 0; i < select_fields.length; i++) {
+ if(select_fields[i].id && select_fields[i].id.substr(0, 7) == 'target_') {
+ select_fields[i].selected = '';
+ if(select_fields[i].id == 'target_' + topic) {
+ select_fields[i].style.display = 'inline';
+ } else {
+ select_fields[i].style.display = 'none';
+ }
+ }
+ }
+
+ // Then send the info to python code via ajax call for persistance
+ get_url('ajax_set_foldertree.py?topic=' + escape(topic) + '&target=');
+}
+
+function wato_tree_target_changed(target_field) {
+ var topic = target_field.id.substr(7, target_field.id.length);
+ var target = target_field.value;
+
+ // Send the info to python code via ajax call for persistance
+ get_url('ajax_set_foldertree.py?topic=' + escape(topic) + '&target=' + escape(target));
+}
+
// adds a variable to a GET url, but tries to remove that
// variable, if it is already existing in the URL. In order
// to simplify the thing, we just look at the *end* of the
diff --git a/web/plugins/pages/wato.py b/web/plugins/pages/wato.py
index 393a631..ffe6379 100644
--- a/web/plugins/pages/wato.py
+++ b/web/plugins/pages/wato.py
@@ -33,4 +33,5 @@ pagehandlers.update({
"automation_login" : wato.page_automation_login,
"automation" : wato.page_automation,
"user_profile" : wato.page_user_profile,
+ "ajax_set_foldertree" : sidebar.ajax_set_foldertree,
})
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index b28346c..821b490 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -24,7 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-import views, time, defaults
+import views, time, defaults, dashboard
import weblib
from lib import *
@@ -70,6 +70,36 @@ sidebar_snapins["about"] = {
# --------------------------------------------------------------
visible_views = [ "allhosts", "searchsvc" ]
+def views_by_topic():
+ s = [ (view.get("topic", _("Other")), view["title"], name)
+ for name, view
+ in html.available_views.items()
+ if not view["hidden"] and not view.get("mobile")]
+
+ # Add all the dashboards to the views list
+ s += [ (_('Dashboards'), d['title'], d_name)
+ for d_name, d
+ in dashboard.dashboards.items()
+ ]
+
+ s.sort()
+
+ # Enforce a certain order on the topics
+ known_topics = [ _('Dashboards'), "Hosts", "Hostgroups", "Services", "Servicegroups",
+ _("Business Intelligence"), _("Problems"), _("Addons") ]
+
+ result = []
+ for topic in known_topics:
+ result.append((topic, s))
+
+ rest = list(set([ t for (t, _t, _v) in s if t not in known_topics ]))
+ rest.sort()
+ for topic in rest:
+ if topic:
+ result.append((topic, s))
+
+ return result
+
def render_views():
def render_topic(topic, s):
first = True
@@ -82,29 +112,16 @@ def render_views():
if first:
html.begin_foldable_container("views", topic, False, topic, indent=True)
first = False
- bulletlink(title, "view.py?view_name=%s" % name)
+ if topic == _('Dashboards'):
+ bulletlink(title, 'dashboard.py?name=%s' % name)
+ else:
+ bulletlink(title, "view.py?view_name=%s" % name)
if not first: # at least one item rendered
html.end_foldable_container()
- s = [ (view.get("topic", _("Other")), view["title"], name)
- for name, view
- in html.available_views.items()
- if not view["hidden"] and not view.get("mobile")]
- s.sort()
-
- # Enforce a certain order on the topics
- known_topics = [ "Hosts", "Hostgroups", "Services", "Servicegroups",
- _("Business Intelligence"), _("Problems"), _("Addons") ]
- for topic in known_topics:
+ for topic, s in views_by_topic():
render_topic(topic, s)
- rest = list(set([ t for (t, _t, _v) in s if t not in known_topics ]))
- rest.sort()
- for topic in rest:
- if topic:
- render_topic(topic, s)
-
-
links = []
if config.may("edit_views"):
if config.debug:
diff --git a/web/plugins/sidebar/wato.py b/web/plugins/sidebar/wato.py
index 185a96c..9e3ab52 100644
--- a/web/plugins/sidebar/wato.py
+++ b/web/plugins/sidebar/wato.py
@@ -139,9 +139,46 @@ def render_wato_foldertree():
del f['.folders'][subfolder['.path']]
update_foldertree(folder_tree)
+ #
+ # Render link target selection
+ #
+ selected_topic, selected_target = config.load_user_file("foldertree", (_('Hosts'), 'allhosts'))
+
+ topic_views = views_by_topic()
+ topics = [ (t, t) for t, s in topic_views ]
+ html.select("topic", topics, selected_topic, onchange = 'wato_tree_topic_changed(this)')
+ html.write('<span class=left>%s</span>' % _('Topic'))
+
+ for topic, views in topic_views:
+ targets = []
+ for t, title, name in views:
+ if config.visible_views and name not in config.visible_views:
+ continue
+ if config.hidden_views and name in config.hidden_views:
+ continue
+ if t == topic:
+ if topic == _('Dashboards'):
+ name = 'dashboard|' + name
+ targets.append((name, title))
+
+ attrs = {}
+ if topic != selected_topic:
+ attrs['style'] = 'display:none'
+ default = ''
+ else:
+ default = selected_target
+
+ html.select("target_%s" % topic, targets, default, attrs = attrs, onchange = 'wato_tree_target_changed(this)')
+
+ html.write('<span class=left>%s</span>' % _('View'))
+ html.write('<hr />')
+
# Now render the whole tree
render_tree_folder(folder_tree)
+def ajax_set_foldertree():
+ config.save_user_file("foldertree", (html.var('topic'), html.var('target')))
+
def render_tree_folder(f):
subfolders = f.get(".folders", {})
is_leaf = len(subfolders) == 0
@@ -171,4 +208,25 @@ sidebar_snapins['wato_foldertree'] = {
'author' : 'Lars Michelsen',
'render' : render_wato_foldertree,
'allowed' : [ 'admin', 'user', 'guest' ],
+ 'styles' : """
+#snapin_wato_foldertree select {
+ float: right;
+ padding: 0;
+ width: 190px;
+}
+#snapin_wato_foldertree span {
+ display: block;
+ color: #ffffff;
+ height: 19px;
+}
+#snapin_wato_foldertree hr {
+ background-color: #fff;
+ height: 1px;
+ padding: 0;
+ margin: 4px;
+ border: 0;
+ /* Needed for older IE versions */
+ color: #fff;
+}
+"""
}