Documentation
¶
Index ¶
- Constants
- Variables
- type Cache
- type CacheEntry
- type Check
- type CheckEntry
- type CheckFunc
- type CheckResponse
- type HealthCheck
- type HttpHealth
- func (h *HttpHealth) HandleChecks(w http.ResponseWriter, r *http.Request)
- func (h *HttpHealth) LoadConfig(path string) error
- func (h *HttpHealth) Register(name string, check Check, cacheTtl int64)
- func (h *HttpHealth) RegisterCachingCheck(name string, check func() CheckResponse, ttl int64) error
- func (h *HttpHealth) RegisterCheck(name string, check func() CheckResponse) error
- func (h *HttpHealth) Run()
- func (h *HttpHealth) RunAllChecks(w http.ResponseWriter, r *http.Request)
- func (h *HttpHealth) RunCheck(w http.ResponseWriter, r *http.Request, checkname string)
Constants ¶
View Source
const ( STATUS_OK = 0 STATUS_WARN = 1 STATUS_CRITICAL = 2 STATUS_UNKNOWN = 3 )
Variables ¶
View Source
var ( CheckCache Cache ListenPort int ListenAddress string ConfigFile string )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
Entries map[string]CacheEntry
}
type CacheEntry ¶
type CacheEntry struct {
Name string
Response CheckResponse
Ttl int64
Created int64
}
func (*CacheEntry) Expires ¶
func (e *CacheEntry) Expires() int64
func (*CacheEntry) ValidFor ¶
func (e *CacheEntry) ValidFor() int64
type Check ¶
type Check interface {
Run() CheckResponse
}
type CheckEntry ¶
type CheckEntry struct {
// contains filtered or unexported fields
}
func (*CheckEntry) Run ¶
func (e *CheckEntry) Run() CheckResponse
type CheckFunc ¶
type CheckFunc func() CheckResponse
func (CheckFunc) Run ¶
func (f CheckFunc) Run() CheckResponse
type CheckResponse ¶
func (*CheckResponse) IsCritical ¶
func (resp *CheckResponse) IsCritical() bool
func (*CheckResponse) IsOk ¶
func (resp *CheckResponse) IsOk() bool
func (*CheckResponse) IsUnknown ¶
func (resp *CheckResponse) IsUnknown() bool
func (*CheckResponse) IsWarn ¶
func (resp *CheckResponse) IsWarn() bool
func (CheckResponse) MarshalJSON ¶
func (resp CheckResponse) MarshalJSON() ([]byte, error)
func (*CheckResponse) StatusText ¶
func (resp *CheckResponse) StatusText() string
type HealthCheck ¶
type HealthCheck struct {
// contains filtered or unexported fields
}
type HttpHealth ¶
type HttpHealth struct {
// contains filtered or unexported fields
}
func NewHttpHealth ¶
func NewHttpHealth() (*HttpHealth, error)
func (*HttpHealth) HandleChecks ¶
func (h *HttpHealth) HandleChecks(w http.ResponseWriter, r *http.Request)
func (*HttpHealth) LoadConfig ¶
func (h *HttpHealth) LoadConfig(path string) error
func (*HttpHealth) Register ¶
func (h *HttpHealth) Register(name string, check Check, cacheTtl int64)
func (*HttpHealth) RegisterCachingCheck ¶
func (h *HttpHealth) RegisterCachingCheck(name string, check func() CheckResponse, ttl int64) error
func (*HttpHealth) RegisterCheck ¶
func (h *HttpHealth) RegisterCheck(name string, check func() CheckResponse) error
func (*HttpHealth) Run ¶
func (h *HttpHealth) Run()
func (*HttpHealth) RunAllChecks ¶
func (h *HttpHealth) RunAllChecks(w http.ResponseWriter, r *http.Request)
func (*HttpHealth) RunCheck ¶
func (h *HttpHealth) RunCheck(w http.ResponseWriter, r *http.Request, checkname string)
Click to show internal directories.
Click to hide internal directories.