Documentation
¶
Index ¶
- Variables
- func DirectoryReader(dir string)
- type ExecHealthTester
- type FileHealthTester
- type HealthTest
- type HealthTestParameters
- type HealthTestRunner
- type HealthTestRunnerEntry
- type HealthTester
- type NodepingHealthTester
- type NtpHealthTester
- type PingdomHealthTester
- type Service
- type Status
- type StatusFile
- type StatusFileData
- type StatusType
- type TcpHealthTester
Constants ¶
This section is empty.
Variables ¶
View Source
var HealthTesterMap = map[string]healthTesterBuilder{
"tcp": newTcpHealthTester,
"ntp": newNtpHealthTester,
"exec": newExecHealthTester,
"file": newFileHealthTester,
"nodeping": newNodepingHealthTester,
"pingdom": newPingdomHealthTester,
}
View Source
var TestRunner = &HealthTestRunner{ entries: make(map[string]*HealthTestRunnerEntry), }
Functions ¶
func DirectoryReader ¶
func DirectoryReader(dir string)
DirectoryReader loads (and regularly re-loads) health .json files from the specified files into the default health registry.
Types ¶
type ExecHealthTester ¶
type ExecHealthTester struct {
// contains filtered or unexported fields
}
func (*ExecHealthTester) String ¶
func (t *ExecHealthTester) String() string
func (*ExecHealthTester) Test ¶
func (t *ExecHealthTester) Test(ht *HealthTest) bool
type FileHealthTester ¶
type FileHealthTester struct {
// contains filtered or unexported fields
}
func (*FileHealthTester) String ¶
func (t *FileHealthTester) String() string
func (*FileHealthTester) Test ¶
func (t *FileHealthTester) Test(ht *HealthTest) bool
type HealthTest ¶
type HealthTest struct { HealthTestParameters IpAddress net.IP Healthy bool // contains filtered or unexported fields }
func NewFromMap ¶
func NewFromMap(i map[string]interface{}) (*HealthTest, error)
func NewTest ¶
func NewTest(ipAddress net.IP, htp HealthTestParameters, tester *HealthTester) *HealthTest
func (*HealthTest) Copy ¶
func (ht *HealthTest) Copy(ipAddress net.IP) *HealthTest
safe copy function that copies the parameters but not (e.g.) the mutex
func (*HealthTest) IP ¶
func (ht *HealthTest) IP() net.IP
func (*HealthTest) IsHealthy ¶
func (ht *HealthTest) IsHealthy() bool
func (*HealthTest) Stop ¶
func (ht *HealthTest) Stop() (err error)
Stop the health check from running
func (*HealthTest) String ¶
func (ht *HealthTest) String() string
Format the health test as a string - used to compare two tests and as an index for the hash
type HealthTestParameters ¶
type HealthTestParameters struct { Frequency time.Duration RetryTime time.Duration Retries int HealthyInitially bool TestName string // contains filtered or unexported fields }
func DefaultHealthTestParameters ¶
func DefaultHealthTestParameters() HealthTestParameters
type HealthTestRunner ¶
type HealthTestRunner struct {
// contains filtered or unexported fields
}
func (*HealthTestRunner) AddTest ¶
func (htr *HealthTestRunner) AddTest(ht *HealthTest, ref string)
func (*HealthTestRunner) IsHealthy ¶
func (htr *HealthTestRunner) IsHealthy(ht *HealthTest) bool
func (*HealthTestRunner) RemoveTest ¶
func (htr *HealthTestRunner) RemoveTest(ht *HealthTest, ref string)
type HealthTestRunnerEntry ¶
type HealthTestRunnerEntry struct { HealthTest // contains filtered or unexported fields }
type HealthTester ¶
type HealthTester interface { String() string Test(*HealthTest) bool }
type NodepingHealthTester ¶
type NodepingHealthTester struct {
// contains filtered or unexported fields
}
func (*NodepingHealthTester) String ¶
func (t *NodepingHealthTester) String() string
func (*NodepingHealthTester) Test ¶
func (t *NodepingHealthTester) Test(ht *HealthTest) bool
type NtpHealthTester ¶
type NtpHealthTester struct {
// contains filtered or unexported fields
}
func (*NtpHealthTester) String ¶
func (t *NtpHealthTester) String() string
func (*NtpHealthTester) Test ¶
func (t *NtpHealthTester) Test(ht *HealthTest) bool
type PingdomHealthTester ¶
type PingdomHealthTester struct {
// contains filtered or unexported fields
}
func (*PingdomHealthTester) String ¶
func (t *PingdomHealthTester) String() string
func (*PingdomHealthTester) Test ¶
func (t *PingdomHealthTester) Test(ht *HealthTest) bool
type Service ¶
type Service struct {
Status StatusType
}
func (*Service) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type StatusFile ¶
type StatusFile struct {
// contains filtered or unexported fields
}
func NewStatusFile ¶
func NewStatusFile(filename string) *StatusFile
func (*StatusFile) Close ¶
func (s *StatusFile) Close() error
func (*StatusFile) GetStatus ¶
func (s *StatusFile) GetStatus(check string) StatusType
func (*StatusFile) Load ¶
func (s *StatusFile) Load(filename string) error
Load imports the data atomically into the status map. If there's a JSON error the old data is preserved.
func (*StatusFile) Reload ¶
func (s *StatusFile) Reload() error
type StatusFileData ¶
type StatusType ¶
type StatusType uint8
const ( StatusUnknown StatusType = iota StatusUnhealthy StatusHealthy )
func GetStatus ¶
func GetStatus(name string) StatusType
func (StatusType) String ¶
func (st StatusType) String() string
type TcpHealthTester ¶
type TcpHealthTester struct {
// contains filtered or unexported fields
}
func (*TcpHealthTester) String ¶
func (t *TcpHealthTester) String() string
func (*TcpHealthTester) Test ¶
func (t *TcpHealthTester) Test(ht *HealthTest) bool
Click to show internal directories.
Click to hide internal directories.