func (c *AlertdContainer) IsUnknown(err error) bool {
	if err != nil {
		return strings.Contains(err.Error(), "No such container:")
	}
	return false
}
IsUnknown is a check that takes the error when the docker API is polled, it
mathes part of the error string that is returned.
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
	}
}