Module: check_mk
Branch: master
Commit: 01c6f90c87cc8f7104d22f995cd4fb38a04e6b06
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=01c6f90c87cc8f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jan 31 16:54:31 2012 +0100
WATO: inventory on clusters working
---
modules/automation.py | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/modules/automation.py b/modules/automation.py
index f6e5213..92ae2c2 100644
--- a/modules/automation.py
+++ b/modules/automation.py
@@ -142,6 +142,31 @@ def automation_try_inventory(args):
args = args[1:]
hostname = args[0]
+
+ # hostname might be a cluster. In that case we compute the clustered
+ # services of that cluster.
+ services = []
+ if is_cluster(hostname):
+ descriptions = set([])
+ for node in nodes_of(hostname):
+ new_services = automation_try_inventory_node(node)
+ for entry in new_services:
+ if host_of_clustered_service(node, entry[6]) == hostname:
+ if entry[6] not in descriptions:
+ services.append(entry)
+ descriptions.add(entry[6]) # make it unique
+
+ else:
+ new_services = automation_try_inventory_node(hostname)
+ for entry in new_services:
+ if host_of_clustered_service(hostname, entry[6]) == hostname:
+ services.append(entry)
+
+ return services
+
+
+
+def automation_try_inventory_node(hostname):
try:
ipaddress = lookup_ipaddress(hostname)
except: