From 31c572b58719d5b310a0b3a6e5872cfd6b4da4d9 Mon Sep 17 00:00:00 2001 From: Wes Bonelli Date: Wed, 28 Jul 2021 12:46:34 -0400 Subject: [PATCH] show agent health status --- .../front_end/src/components/agents/agent.vue | 121 ++++++++++++++---- plantit/plantit/agents/views.py | 3 +- plantit/plantit/celery_tasks.py | 3 +- plantit/plantit/utils.py | 15 ++- 4 files changed, 111 insertions(+), 31 deletions(-) diff --git a/plantit/front_end/src/components/agents/agent.vue b/plantit/front_end/src/components/agents/agent.vue index f410e46c..67997163 100644 --- a/plantit/front_end/src/components/agents/agent.vue +++ b/plantit/front_end/src/components/agents/agent.vue @@ -110,7 +110,7 @@ v-if="getAgent.logo" rounded class="card-img-right overflow-hidden" - style="max-height: 5rem;position: absolute;right: 20px;top: 20px;z-index:1" + style="max-height: 3rem;position: absolute;right: 20px;top: 20px;z-index:1" right :src="getAgent.logo" > @@ -118,7 +118,7 @@ -

+ + {{ getAgent.name }} -

+ Owner -
- {{ - getAgent.description - }}
-
-
+ {{ + getAgent.description + }} + +
+
+ + + {{ line + '\n' }} + +
+
+ +
+
bool: Returns: True if the agent was successfully reached, otherwise false. """ + output = [] try: if agent.authentication == AgentAuthentication.PASSWORD: ssh = SSH(host=agent.hostname, port=int(auth['port']), username=auth['username'], password=auth['password']) @@ -1775,12 +1776,16 @@ def is_healthy(agent: Agent, auth: dict) -> bool: with ssh: logger.info(f"Checking agent {agent.name}'s health") - for line in execute_command(ssh=ssh, precommand=':', command=f"pwd", directory=agent.workdir): logger.info(line) + for line in execute_command(ssh=ssh, precommand=':', command=f"pwd", directory=agent.workdir): + logger.info(line) + output.append(line) logger.info(f"Agent {agent.name} healthcheck succeeded") - return True + return True, output except: - logger.warning(f"Agent {agent.name} healthcheck failed:\n{traceback.format_exc()}") - return False + msg = f"Agent {agent.name} healthcheck failed:\n{traceback.format_exc()}" + logger.warning(msg) + output.append(msg) + return False, output # MIAPPE