when using SNMP and TCP on one host
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 2bf58fa99334f1ba2293c075fb17d1ea94a1e213
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2bf58fa99334f1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Sep 14 14:59:22 2012 +0200
cmk -D shows multiple agent types e.g. when using SNMP and TCP on one host
---
ChangeLog | 1 +
modules/check_mk.py | 22 +++++++++++++++-------
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fd88aa1..eaecce0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
* Contacts can now define *_notification_commands attributes which can now
override the default notification command check-mk-notify
* SNMP scan: fixed case where = was contained in SNMP info
+ * cmk -D shows multiple agent types e.g. when using SNMP and TCP on one host
Checks & Agents:
* New Checks for Siemens Blades (BX600)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 230cfeb..4491a82 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -3581,14 +3581,18 @@ def dump_host(hostname):
print tty_yellow + "Parents: " + tty_normal + ",
".join(parents_list)
print tty_yellow + "Host groups: " + tty_normal + ",
".join(hostgroups_of(hostname))
print tty_yellow + "Contact groups: " + tty_normal + ",
".join(host_contactgroups_of([hostname]))
- agenttype = "TCP (port: %d)" % agent_port_of(hostname)
- dapg = get_datasource_program(hostname, ipaddress)
- if dapg:
- agenttype = "Datasource program: %s" % dapg
+
+ agenttypes = []
+ if is_tcp_host(hostname):
+ agenttypes.append("TCP (port: %d)" % agent_port_of(hostname))
+ else:
+ dapg = get_datasource_program(hostname, ipaddress)
+ if dapg:
+ agenttypes.append("Datasource program: %s" % dapg)
if is_snmp_host(hostname):
if is_usewalk_host(hostname):
- agenttype = "SNMP (use stored walk)"
+ agenttypes.append("SNMP (use stored walk)")
else:
credentials = snmp_credentials_of(hostname)
if is_bulkwalk_host(hostname):
@@ -3598,8 +3602,12 @@ def dump_host(hostname):
portinfo = snmp_port_of(hostname)
if portinfo == None:
portinfo = 'default'
- agenttype = "SNMP (community: '%s', bulk walk: %s, port:
%s)" % (credentials, bulk, portinfo)
- print tty_yellow + "Type of agent: " + tty_normal + agenttype
+ agenttypes.append("SNMP (community: '%s', bulk walk: %s, port:
%s)" % (credentials, bulk, portinfo))
+
+ if is_ping_host(hostname):
+ agenttypes.append('PING only')
+
+ print tty_yellow + "Type of agent: " + tty_normal + '\n
'.join(agenttypes)
is_aggregated = host_is_aggregated(hostname)
if is_aggregated:
print tty_yellow + "Is aggregated: " + tty_normal +
"yes"