From 40f72a8323915debb721a8dee25fc15ebaaf4358 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Mon, 26 Oct 2015 11:16:11 -0700 Subject: [PATCH] Marking the state of a service as critical if the Docker Daemon doesn't respond while running checks --- command/agent/check.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/command/agent/check.go b/command/agent/check.go index 01526e8089..67cd8504e0 100644 --- a/command/agent/check.go +++ b/command/agent/check.go @@ -597,19 +597,21 @@ func (c *CheckDocker) check() { exec = exec } else { c.Logger.Printf("[DEBUG] agent: Error while creating Exec: %s", err.Error()) + c.Notify.UpdateCheck(c.CheckID, structs.HealthCritical, fmt.Sprintf("Unable to create Exec, error: %s", err.Error())) + return } err = c.dockerClient.StartExec(exec.ID, docker.StartExecOptions{Detach: false, Tty: false}) if err != nil { c.Logger.Printf("[DEBUG] Error in executing health checks: %s", err.Error()) - c.Notify.UpdateCheck(c.CheckID, structs.HealthCritical, err.Error()) + c.Notify.UpdateCheck(c.CheckID, structs.HealthCritical, fmt.Sprintf("Unable to start exec: %s", err.Error())) return } execInfo, err := c.dockerClient.InspectExec(exec.ID) if err != nil { c.Logger.Printf("[DEBUG] Error in inspecting check result : %s", err.Error()) - c.Notify.UpdateCheck(c.CheckID, structs.HealthCritical, err.Error()) + c.Notify.UpdateCheck(c.CheckID, structs.HealthCritical, fmt.Sprintf("Unable to inspect Exec: %s", err.Error())) return }