func (c *AlertdContainer) HasBecomeKnown(e error) bool {
	return c.ExistenceCheck.AlertActive && e == nil
}
HasBecomeKnown returns true if there is an active alert and error is nil, which means
that the container check was successful and the 0 index check (existence check) cannot
be active
package cmd
import (
	"fmt"
	"strings"
	"github.com/docker/docker/api/types"
)
type MetricCheck struct {
	AlertActive bool
	Limit       *uint64
}
func (c *MetricCheck) ToggleAlertActive() {
	c.AlertActive = !c.AlertActive
}
type StaticCheck struct {
	AlertActive bool
	Expected    *bool
}
func (c *StaticCheck) ToggleAlertActive() {
	c.AlertActive = !c.AlertActive
}
type Checker interface {
	CPUCheck(s *types.Stats)
	MemCheck(s *types.Stats)
	PIDCheck(s *types.Stats)
	ExistenceCheck(a *types.ContainerJSON, e error)
	RunningCheck(a *types.ContainerJSON, e error)
}
type AlertdContainer struct {
	Name     string `json:"name"`
	Alert    *Alert
	CPUCheck *MetricCheck
	MemCheck *MetricCheck
	PIDCheck *MetricCheck
	ExistenceCheck *StaticCheck
	RunningCheck   *StaticCheck
}
func (c *AlertdContainer) CheckMetrics(s *types.Stats, e error) {
	switch {
	case e != nil:
		c.Alert.Add(e, nil, "Received an unknown error", "")
	default:
		if c.CPUCheck.Limit != nil {
			c.CheckCPUUsage(s)
		}
		if c.PIDCheck.Limit != nil {
			c.CheckMinPids(s)
		}
		if c.MemCheck.Limit != nil {
			c.CheckMemory(s)
		}
	}
}
func (c *AlertdContainer) CheckStatics(j *types.ContainerJSON, e error) {
	c.CheckExists(e)
	if j != nil && c.RunningCheck.Expected != nil {
		c.CheckRunning(j)
	}
}
func (c *AlertdContainer) ChecksShouldStop() bool {
	switch {
	case c.RunningCheck.AlertActive:
		return true
	case c.ExistenceCheck.AlertActive:
		return true
	case c.RunningCheck.Expected != nil && !*c.RunningCheck.Expected:
		return true
	case c.Alert.ShouldSend():
		return true
	default:
		return false
	}
}
func (c *AlertdContainer) IsUnknown(err error) bool {
	if err != nil {
		return strings.Contains(err.Error(), "No such container:")
	}
	return false
}
func (c *AlertdContainer) HasErrored(e error) bool {
	return e != nil && !c.IsUnknown(e)
}