mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-09 04:52:35 +02:00
fix: docker monitor now uses container status
This commit is contained in:
parent
04e118c081
commit
26d259b952
1 changed files with 13 additions and 0 deletions
|
@ -29,6 +29,19 @@ func (mon *DockerHealthMonitor) CheckHealth() (result *health.HealthCheckResult,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return mon.fallback.CheckHealth()
|
return mon.fallback.CheckHealth()
|
||||||
}
|
}
|
||||||
|
status := cont.State.Status
|
||||||
|
switch status {
|
||||||
|
case "dead", "exited", "paused", "restarting", "removing":
|
||||||
|
return &health.HealthCheckResult{
|
||||||
|
Healthy: false,
|
||||||
|
Detail: "container is " + status,
|
||||||
|
}, nil
|
||||||
|
case "created":
|
||||||
|
return &health.HealthCheckResult{
|
||||||
|
Healthy: false,
|
||||||
|
Detail: "container is not started",
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
if cont.State.Health == nil {
|
if cont.State.Health == nil {
|
||||||
return mon.fallback.CheckHealth()
|
return mon.fallback.CheckHealth()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue