Module: check_mk
Branch: master
Commit: e146cb34450f13901fb873c094b54a8954298aad
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e146cb34450f13…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 6 10:04:12 2012 +0100
removed link to non existing site; Folder details can be read without fetching child infos
---
web/htdocs/wato.py | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 6648131..4469323 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -427,7 +427,7 @@ def save_all_folders():
# it in g_folders, load recursively all subfolders and then
# return the folder object. The case the .wato file is missing
# it will be assume to contain default values.
-def load_folder(dir, name="", path="", parent=None):
+def load_folder(dir, name="", path="", parent=None, childs = True):
fn = dir + "/.wato"
try:
folder = eval(file(fn).read())
@@ -457,19 +457,20 @@ def load_folder(dir, name="", path="", parent=None):
folder[".siteid"] = default_site()
# Now look subdirectories
- for entry in os.listdir(dir):
- if entry[0] == '.': # entries '.' and '..'
- continue
+ if childs:
+ for entry in os.listdir(dir):
+ if entry[0] == '.': # entries '.' and '..'
+ continue
- p = dir + "/" + entry
+ p = dir + "/" + entry
- if os.path.isdir(p):
- if path == "":
- subpath = entry
- else:
- subpath = path + "/" + entry
- f = load_folder(p, entry, subpath, folder)
- folder[".folders"][entry] = f
+ if os.path.isdir(p):
+ if path == "":
+ subpath = entry
+ else:
+ subpath = path + "/" + entry
+ f = load_folder(p, entry, subpath, folder)
+ folder[".folders"][entry] = f
g_folders[path] = folder
return folder
@@ -876,13 +877,12 @@ def mode_folder(phase):
have_something = show_subfolders(g_folder)
have_something = show_hosts(g_folder) or have_something
if not have_something:
- url = "wato.py?mode=view_ruleset&varname=snmp_communities"
render_main_menu([
("newhost", _("Create new host"), "new", "hosts",
_("Click here to create a host to be monitored. Please make sure that "
"you first have installed the Check_MK agent on that host. If that "
"host shall be monitored via SNMP, please make sure, that the monitoring "
- "system has access and the <a href='%s'>SNMP community</a> has been set.") % url),
+ "system has access and the SNMP community has been set.")),
("newcluster", _("Create new cluster"), "new_cluster", "hosts",
_("Click here to create a high availability cluster to be monitored. You will "
"created a virtual host in the monitoring that is based on the data of two "
Module: check_mk
Branch: master
Commit: 96460f838481a68e84411dec3f21cacdc2c58e02
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=96460f838481a6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 6 10:10:31 2012 +0100
Recoded the foldertree snapin to build its own folder tree
---
web/plugins/sidebar/wato.py | 59 +++++++++++++++++++++++-------------------
1 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/web/plugins/sidebar/wato.py b/web/plugins/sidebar/wato.py
index d468a37..69ed5dd 100644
--- a/web/plugins/sidebar/wato.py
+++ b/web/plugins/sidebar/wato.py
@@ -100,15 +100,19 @@ def render_wato_foldertree():
def render_wato_foldertree():
html.live.set_prepend_site(True)
query = "GET hosts\n" \
- "Columns: name host_filename"
+ "Stats: state >= 0\n" \
+ "Columns: filename"
hosts = html.live.query(query)
html.live.set_prepend_site(False)
hosts.sort()
- # Get number of hosts by folder
+ # After the query we have a list of lists where each
+ # row is a folder with the number of hosts on this level.
+ #
+ # Now get number of hosts by folder
# Count all childs for each folder
user_folders = {}
- for site, hostname, wato_folder in hosts:
+ for site, wato_folder, num in hosts:
# Remove leading /wato/
wato_folder = wato_folder[6:]
@@ -119,25 +123,26 @@ def render_wato_foldertree():
this_folder = '/'.join(folder_parts[:num_parts])
if this_folder not in user_folders:
- user_folders[this_folder] = wato.api.get_folder(this_folder)
- user_folders[this_folder]['.num_hosts'] = 1
- else:
- user_folders[this_folder]['.num_hosts'] += 1
-
- # Update the WATO folder tree with the user specific permissions
- folder_tree = wato.api.get_folder_tree()
- def update_foldertree(f):
- this_path = f['.path']
- if this_path in user_folders:
- f['.num_hosts'] = user_folders[this_path]['.num_hosts']
-
- for subfolder_path, subfolder in f.get(".folders", {}).items():
- # Only handle paths which the user is able to see
- if subfolder['.path'] in user_folders:
- update_foldertree(subfolder)
+ wato_folder = wato.load_folder(wato.root_dir + this_folder, childs = False)
+ user_folders[this_folder] = {
+ 'title': wato_folder['title'],
+ '.path': this_folder,
+ '.num_hosts': num,
+ '.folders': {},
+ }
else:
- del f['.folders'][subfolder['.path']]
- update_foldertree(folder_tree)
+ user_folders[this_folder]['.num_hosts'] += num
+
+ #
+ # Now build the folder tree
+ #
+ for folder_path, folder in user_folders.items():
+ if not folder_path:
+ continue
+ folder_parts = folder_path.split('/')
+ parent_folder = '/'.join(folder_parts[:-1])
+ user_folders[parent_folder]['.folders'][folder_path] = folder
+ del user_folders[folder_path]
#
# Render link target selection
@@ -173,7 +178,7 @@ def render_wato_foldertree():
html.write('<span class=left>%s</span>' % _('View:'))
# Now render the whole tree
- render_tree_folder(folder_tree)
+ render_tree_folder(user_folders[''])
def ajax_set_foldertree():
config.save_user_file("foldertree", (html.var('topic'), html.var('target')))
@@ -183,12 +188,12 @@ def render_tree_folder(f):
is_leaf = len(subfolders) == 0
# Suppress indentation for non-emtpy root folder
- if ".parent" not in f and is_leaf:
+ if f['.path'] == '' and is_leaf:
html.write("<ul>") # empty root folder
- elif ".parent" in f:
+ elif f and f['.path'] != '':
html.write("<ul style='padding-left: 0px;'>")
- title = '<a href="#" onclick="wato_tree_click(%r);">%s (%d)</a>' % (
+ title = '<a href="#" onclick="wato_tree_click(\'%s\');">%s (%d)</a>' % (
f[".path"], f["title"], f[".num_hosts"])
if not is_leaf:
@@ -198,12 +203,12 @@ def render_tree_folder(f):
html.end_foldable_container()
else:
html.write("<li>" + title + "</li>")
- if ".parent" in f or is_leaf:
+ if f['.path'] == '' and f or is_leaf:
html.write("</ul>")
sidebar_snapins['wato_foldertree'] = {
'title' : _('WATO Foldertree'),
- 'description' : _(''),
+ 'description' : _('This snapin shows the folders defined in WATO. It can be used to open views filtered by theWATO folder.'),
'author' : 'Lars Michelsen',
'render' : render_wato_foldertree,
'allowed' : [ 'admin', 'user', 'guest' ],
Module: check_mk
Branch: master
Commit: 24274e27e4ec80be6f2213d3c3181ba0e0622c87
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=24274e27e4ec80…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Feb 3 16:24:00 2012 +0100
Make agent_simulator and usewalk_hosts WATOable
---
web/plugins/wato/check_mk_configuration.py | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index 16239a9..089c6ad 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -197,6 +197,15 @@ register_configvar(group,
"been copied here from another monitoring site.")),
need_restart = True)
+register_configvar(group,
+ "agent_simulator",
+ Checkbox(title = _("SNMP Agent Simulator"),
+ label = _("Process stored SNMP walks with agent simulator"),
+ help = _("When using stored SNMP walks you can place inline code generating "
+ "dynamic simulation data. This feature can be activated here. There "
+ "is a big chance that you will never need this feature...")),
+ need_restart = True)
+
register_configvar(group,
"delay_precompile",
@@ -812,3 +821,10 @@ register_rule(group,
"<tt><HOST></tt>."),
label = _("Command line to execute")))
+register_rule(group,
+ "usewalk_hosts",
+ title = _("Hosts that simulate SNMP by using a stored SNMP walk"),
+ help = _("This ruleset helps in test and development. You can create stored SNMP "
+ "walks on the command line with cmk --snmpwalk HOSTNAME. A host that "
+ "is configured with this ruleset will then use the information from that "
+ "file instead of using real SNMP. "))
Module: check_mk
Branch: master
Commit: 95436160993cb6a27d377a3fe32e3ec2c58db59c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=95436160993cb6…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Feb 2 17:31:21 2012 +0100
if/if64: omit check result on counter wrap
But only if bandwidth traffic levels
are used.
---
ChangeLog | 2 ++
checks/if.include | 4 ++++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4af43e1..ec5c357 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -47,6 +47,8 @@
* cisco_temp_sensor: new check for temperature sensors of Cisco NEXUS
and other new Cisco devices
* oracle_tablespace: Fixed tablespace size/free space calculations
+ * FIX: if/if64: omit check result on counter wrap if bandwidth traffic levels
+ are used.
Multisite:
* Improve transaction handling and reload detection: user can have
diff --git a/checks/if.include b/checks/if.include
index dedc1fd..f8ec10b 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -264,6 +264,10 @@ def check_if_common(item, params, info):
# if at least one counter wrapped, we do not handle the counters at all
if wrapped:
+ # If there is a threshold on the bandwidth, we cannot proceed
+ # futher (the check would be flapping to green on a wrap)
+ if bw_crit != None:
+ raise MKCounterWrapped("", "Counter wrap, skipping checks this time")
perfdata = []
else:
perfdata.append(("outqlen", saveint(ifOutQLen)))