Module: check_mk
Branch: master
Commit: a8b704d5d1a1be60d01cc1b2db153a45b8b27cc5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a8b704d5d1a1be…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Oct 9 20:42:51 2013 +0200
WATO: feature for restricting bulk inventory to hosts with failed inv checks
---
ChangeLog | 4 +++-
web/htdocs/wato.py | 20 +++++++++++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3a639fc..267e43f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,11 +39,13 @@
WATO:
* Rule "State and count of processes": New configuration options:
virtual and resident memory levels
+ * Added title of tests to LDAP diagnose table
+ * Bulk inventory: new checkbox to only include hosts that have a failed
+ inventory check.
* FIX: The rule "State and count of processes" is no longer available
in "Parameters for inventorized check". This rule was solely
intented for "Manual checks" configuration
* FIX: Trying to prevent auth.php errors while file is being updated
- * Added title of tests to LDAP diagnose table
1.2.3i2:
Core:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 744d1ee..34d6e0e 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2656,6 +2656,11 @@ def mode_bulk_inventory(phase):
config.need_permission("wato.services")
+ if html.get_checkbox("only_failed_invcheck"):
+ failed_invcheck_hosts = find_hosts_with_failed_inventory_check()
+ else:
+ failed_invcheck_hosts = None
+
# 'all' not set -> only inventorize checked hosts
if not html.var("all"):
complete_folder = False
@@ -2666,7 +2671,8 @@ def mode_bulk_inventory(phase):
hostnames = get_hostnames_from_checkboxes(filterfunc)
items = [ "%s|%s" % (g_folder[".path"], hostname)
- for hostname in hostnames ]
+ for hostname in hostnames
+ if (failed_invcheck_hosts == None or hostname in failed_invcheck_hosts) ]
for hostname in hostnames:
check_host_permissions(hostname)
@@ -2677,6 +2683,8 @@ def mode_bulk_inventory(phase):
items = []
hostnames = []
for hostname, folder in entries:
+ if failed_invcheck_hosts != None and hostname not in failed_invcheck_hosts:
+ continue
check_host_permissions(hostname, folder=folder)
items.append("%s|%s" % (folder[".path"], hostname))
hostnames.append(hostname)
@@ -2720,11 +2728,21 @@ def mode_bulk_inventory(phase):
html.checkbox("recurse", True, label=_("Include all
subfolders"))
html.write("<br>")
html.checkbox("only_failed", False, label=_("Only include hosts
that failed on previous inventory"))
+ html.write("<br>")
+ html.checkbox("only_failed_invcheck", False, label=_("Only include
hosts with a failed inventory check"))
# Start button
forms.end()
html.button("_start", _("Start"))
+def find_hosts_with_failed_inventory_check():
+ hosts = html.live.query_column(
+ "GET services\n"
+ "Filter: description = Check_MK inventory\n"
+ "Filter: state > 0\n"
+ "Columns: host_name")
+ return hosts
+
#.
# .-Bulk-Edit------------------------------------------------------------.
# | ____ _ _ _____ _ _ _ |