Module: check_mk
Branch: master
Commit: 3561c34b9abac78f17bd96c896f7f6bca8cdd17f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3561c34b9abac7…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Feb 17 11:36:47 2011 +0100
FIX: inventory check on mixed hosts ignored TCP checks
---
ChangeLog | 1 +
modules/check_mk.py | 12 ++++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e9433df..8afea28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
(needed for Shinken)
* FIX: read *.include files before checks. Fixes df_netapp not finding
its check function
+ * FIX: inventory checks on SNMP+TCP hosts ignored new TCP checks
Checks & Agents:
* ucd_cpu_load: new check for CPU load via UCD SNMP agent
diff --git a/modules/check_mk.py b/modules/check_mk.py
index ff165dd..a98a40d 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1798,15 +1798,19 @@ def check_inventory(hostname):
newchecks = []
newitems = []
total_count = 0
- only_snmp = is_snmp_host(hostname)
+ is_snmp = is_snmp_host(hostname)
+ is_tcp = is_tcp_host(hostname)
check_table = get_check_table(hostname)
hosts_checktypes = set([ ct for (ct, item), params in check_table.items() ])
try:
for ct in inventorable_checktypes("all"):
- if only_snmp and not check_uses_snmp(ct):
- continue # No TCP checks on SNMP-only hosts
+ if check_uses_snmp(ct) and not is_snmp:
+ continue # Skip SNMP checks on non-SNMP hosts
elif check_uses_snmp(ct) and ct not in hosts_checktypes:
- continue # Do not look for new SNMP services (why?)
+ continue # Do not look for new SNMP services (maybe change in future)
+ elif not check_uses_snmp(ct) and not is_tcp:
+ continue # Skip TCP checks on non-TCP hosts
+
new = make_inventory(ct, [hostname], True)
newitems += new
count = len(new)