From 0b478404cf1c5596be47663c214d459a521be318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Fo=C5=A1n=C3=A1r?= Date: Mon, 15 Jan 2024 20:36:22 +0100 Subject: [PATCH] make DOWN the default fallback for docker container healthcheck --- server/model/monitor.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index b6c393e44..483f5266d 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -770,15 +770,20 @@ class Monitor extends BeanModel { let res = await axios.request(options); if (res.data.State.Running) { - if (res.data.State.Health && ![ "healthy", "unhealthy", "" ].includes(res.data.State.Health.Status)) { - bean.status = PENDING; - bean.msg = res.data.State.Health.Status; - } else if (res.data.State.Health && res.data.State.Health.Status === "unhealthy") { - bean.status = DOWN; - bean.msg = res.data.State.Health.Status; + if (res.data.State.Health) { + if ([ "", "healthy" ].includes(res.data.State.Health.Status)) { + bean.status = UP; + bean.msg = res.data.State.Health.Status; + } else if (res.data.State.Health.Status === "starting") { + bean.status = PENDING; + bean.msg = res.data.State.Health.Status; + } else { + bean.status = DOWN; + bean.msg = res.data.State.Health.Status; + } } else { - bean.status = UP; - bean.msg = res.data.State.Health ? res.data.State.Health.Status : res.data.State.Status; + bean.status = DOWN; + bean.msg = res.data.State.Status; } } else { throw Error("Container State is " + res.data.State.Status);