Merge pull request #3169 from janow25/docker-health-check

Added Docker Health Status Support
This commit is contained in:
Louis Lam 2023-07-01 02:55:05 +08:00 committed by GitHub
commit de74efb2e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -626,9 +626,15 @@ class Monitor extends BeanModel {
log.debug("monitor", `[${this.name}] Axios Request`);
let res = await axios.request(options);
if (res.data.State.Running) {
bean.status = UP;
bean.msg = res.data.State.Status;
if (res.data.State.Health && res.data.State.Health.Status !== "healthy") {
bean.status = PENDING;
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;
}
} else {
throw Error("Container State is " + res.data.State.Status);
}