提交 3a9ec4e4 编写于 作者: N Nicolas Hennion

Make the Docker API connection timeout configurable

上级 487a758e
...@@ -351,6 +351,8 @@ port_default_gateway=True ...@@ -351,6 +351,8 @@ port_default_gateway=True
[docker] [docker]
disable=False disable=False
# Timeout for API calls (in seconds, default is 1)
timeout=1
# Only show specific containers (comma separeted list of container name or regular expression) # Only show specific containers (comma separeted list of container name or regular expression)
# Comment this line to display all containers (default configuration) # Comment this line to display all containers (default configuration)
#show=telegraf #show=telegraf
......
...@@ -137,7 +137,7 @@ class Plugin(GlancesPlugin): ...@@ -137,7 +137,7 @@ class Plugin(GlancesPlugin):
def connect(self): def connect(self):
"""Connect to the Docker server.""" """Connect to the Docker server."""
try: try:
ret = docker.from_env() ret = docker.from_env(timeout=int(self.get_conf_value('timeout', '1')))
except Exception as e: except Exception as e:
logger.error("docker plugin - Can not connect to Docker ({})".format(e)) logger.error("docker plugin - Can not connect to Docker ({})".format(e))
ret = None ret = None
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册