mirror of
https://github.com/valitydev/yandex-tank.git
synced 2024-11-06 18:35:18 +00:00
consider ssh timeout parameter
This commit is contained in:
parent
0adabe56a2
commit
4948cf523c
@ -44,10 +44,11 @@ class Config(object):
|
|||||||
|
|
||||||
class SecuredShell(object):
|
class SecuredShell(object):
|
||||||
|
|
||||||
def __init__(self, host, port, username):
|
def __init__(self, host, port, username, timeout):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
self.username = username
|
self.username = username
|
||||||
|
self.timeout = timeout
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
logger.debug("Opening SSH connection to {host}:{port}".format(
|
logger.debug("Opening SSH connection to {host}:{port}".format(
|
||||||
@ -59,6 +60,7 @@ class SecuredShell(object):
|
|||||||
self.host,
|
self.host,
|
||||||
port=self.port,
|
port=self.port,
|
||||||
username=self.username,
|
username=self.username,
|
||||||
|
timeout=self.timeout,
|
||||||
)
|
)
|
||||||
return client
|
return client
|
||||||
|
|
||||||
@ -124,7 +126,7 @@ class AsyncSession(object):
|
|||||||
class AgentClient(object):
|
class AgentClient(object):
|
||||||
"""Agent client connection"""
|
"""Agent client connection"""
|
||||||
|
|
||||||
def __init__(self, adr):
|
def __init__(self, adr, timeout):
|
||||||
self.run = []
|
self.run = []
|
||||||
self.host = adr['host']
|
self.host = adr['host']
|
||||||
self.username = adr['username']
|
self.username = adr['username']
|
||||||
@ -138,7 +140,7 @@ class AgentClient(object):
|
|||||||
self.session = None
|
self.session = None
|
||||||
self.buffer = ""
|
self.buffer = ""
|
||||||
self.ssh = SecuredShell(
|
self.ssh = SecuredShell(
|
||||||
self.host, self.port, self.username)
|
self.host, self.port, self.username, timeout)
|
||||||
|
|
||||||
handle, cfg_path = tempfile.mkstemp('.cfg', 'agent_')
|
handle, cfg_path = tempfile.mkstemp('.cfg', 'agent_')
|
||||||
os.close(handle)
|
os.close(handle)
|
||||||
@ -328,7 +330,7 @@ class MonitoringCollector(object):
|
|||||||
logger.debug('Creating agents')
|
logger.debug('Creating agents')
|
||||||
for adr in agent_config:
|
for adr in agent_config:
|
||||||
logger.debug('Creating agent: %s', adr)
|
logger.debug('Creating agent: %s', adr)
|
||||||
agent = AgentClient(adr)
|
agent = AgentClient(adr, timeout=self.ssh_timeout)
|
||||||
logger.debug('Install monitoring agent. Host: %s', agent.host)
|
logger.debug('Install monitoring agent. Host: %s', agent.host)
|
||||||
agent_config = agent.install(loglevel)
|
agent_config = agent.install(loglevel)
|
||||||
if agent_config:
|
if agent_config:
|
||||||
|
Loading…
Reference in New Issue
Block a user