提交 4bfe32c6 编写于 作者: N Nicolargo

Add ICMP (system call to ping) in the Glances port plugin

上级 a38b6b48
......@@ -180,25 +180,28 @@ mem_warning=70
mem_critical=90
[ports]
# TCP Ports scanner plugin configuration
# Ports scanner plugin configuration
# Interval in second between scan
refresh=30
# Set the timeout for a scan
# Set the default timeout for a scan (can be overwrite in the scan list)
timeout=3
# Define the scan list
# host (name or IP) and port (TCP) are mandatory
# description is optinal (set to host:port)
# host (name or IP) is mandatory
# port is optional (set to 0 = ICMP check by default)
# description is optional (set to host:port)
port_1_host=www.google.com
port_1_port=443
port_1_description=Internet
port_2_host=www.free.fr
port_2_port=80
port_2_description=ISP
port_3_host=192.168.0.1
port_3_port=80
port_3_description=Home Box
port_4_host=192.168.5.1
port_1_description=Internet Web
port_2_host=www.google.com
port_2_description=Internet Ping
port_3_host=www.free.fr
port_3_description=Free ISP
port_4_host=192.168.0.1
port_4_port=80
port_5_description=Home Box
port_5_host=192.168.5.1
port_5_port=80
port_5_timeout=2
##############################################################################
# Client/server
......
......@@ -107,7 +107,7 @@ class GlancesAmp(object):
logger.warning("{}: Can not find configuration key {} in section {}".format(self.NAME, k, self.amp_name))
self.configs['enable'] = 'false'
else:
logger.warning("{} is disabled".format(self.NAME))
logger.debug("{} is disabled".format(self.NAME))
# Init the count to 0
self.configs['count'] = 0
......
......@@ -53,14 +53,17 @@ class GlancesPortsList(object):
new_port = {}
postfix = 'port_%s_' % str(i)
# Read mandatories configuration keys: host and port
for s in ['host', 'port']:
new_port[s] = config.get_value(self._section, '%s%s' % (postfix, s))
# Read mandatories configuration key: host
new_port['host'] = config.get_value(self._section, '%s%s' % (postfix, 'host'))
if new_port['host'] is None or new_port['port'] is None:
if new_port['host'] is None:
continue
# Read optionals configuration keys
# Port is set to 0 by default. 0 mean ICMP check instead of TCP check
new_port['port'] = config.get_value(self._section,
'%s%s' % (postfix, 'port'),
0)
new_port['description'] = config.get_value(self._section,
'%sdescription' % postfix,
default="%s:%s" % (new_port['host'], new_port['port']))
......@@ -72,7 +75,9 @@ class GlancesPortsList(object):
new_port['refresh'] = refresh
# Timeout in second
new_port['timeout'] = timeout
new_port['timeout'] = config.get_value(self._section,
'%stimeout' % postfix,
default=timeout)
# Add the server to the list
logger.debug("Add port %s:%s to the static list" % (new_port['host'], new_port['port']))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册