Module: check_mk
Branch: master
Commit: a369804f3dacae7cb10ae41c2492e20f76f7aed8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a369804f3dacaeā¦
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Feb 16 12:00:33 2016 +0100
#3214 FIX Removing SNMP checks for non SNMP hosts and agent based checks for non agent
hosts
When changing the agent type of a host, for example from Agent to SNMP, vice versa or
from Agent+SNMP to only SNMP it could happen that former discovered services of now
disabled protocols were left assigned to a host leading to still contacting the host
with the disabled protocol. This could only be solved by rediscovering the services
of this host.
This has now been changed to disable the services right after next restart/reload of
the core after changing the agent type.
---
.werks/3214 | 17 +++++++++++++++++
ChangeLog | 1 +
modules/check_mk.py | 17 +++++++++++++++++
3 files changed, 35 insertions(+)
diff --git a/.werks/3214 b/.werks/3214
new file mode 100644
index 0000000..3598863
--- /dev/null
+++ b/.werks/3214
@@ -0,0 +1,17 @@
+Title: Removing SNMP checks for non SNMP hosts and agent based checks for non agent
hosts
+Level: 2
+Component: core
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1455620283
+
+When changing the agent type of a host, for example from Agent to SNMP, vice versa or
+from Agent+SNMP to only SNMP it could happen that former discovered services of now
+disabled protocols were left assigned to a host leading to still contacting the host
+with the disabled protocol. This could only be solved by rediscovering the services
+of this host.
+
+This has now been changed to disable the services right after next restart/reload of
+the core after changing the agent type.
diff --git a/ChangeLog b/ChangeLog
index 891c6d3..674b421 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
1.2.9i1:
Core & Setup:
* 3193 FIX: Fixed fake check results for hosts...
+ * 3214 FIX: Removing SNMP checks for non SNMP hosts and agent based checks for non
agent hosts...
Checks & Agents:
* 3183 aruba_wlc_aps: new check which monitors the provisioned accesspoints of an
Aruba Network WLAN Controller
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 447e697..92b5434 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -506,6 +506,16 @@ def output_check_info():
def active_check_service_description(act_info, params):
return
sanitize_service_description(act_info["service_description"](params).replace('$HOSTNAME$',
g_hostname))
+
+def is_snmp_check(check_name):
+ return check_name in snmp_info
+
+
+def is_tcp_check(check_name):
+ return check_name in check_info \
+ and check_name not in snmp_info
+
+
#.
# .--Hosts---------------------------------------------------------------.
# | _ _ _ |
@@ -1814,6 +1824,13 @@ def get_check_table(hostname, remove_duplicates=False,
use_cache=True, world='co
elif hostlist != []:
raise MKGeneralException("Invalid entry '%r' in check table.
Must be single hostname or list of hostnames" % hostlist)
+ # Skip SNMP checks for non SNMP hosts (might have been discovered before with
other
+ # agent setting. Remove them without rediscovery). Same for agent based checks.
+ if not is_snmp_host(hostname) and is_snmp_check(checkname):
+ return
+ if not is_tcp_host(hostname) and is_tcp_check(checkname):
+ return
+
if hosttags_match_taglist(hosttags, tags) and \
in_extraconf_hostlist(hostlist, hostname):
descr = service_description(hostname, checkname, item)