Documentation ¶
Overview ¶
Package probe contains the probe implementation.
Index ¶
- func CheckEmpty(s string) string
- func CleanData(p []Prober)
- func CleanDataFile(filename string, backups int)
- func LoadDataFromFile(filename string) error
- func SaveDataToFile(filename string) error
- func SetMetaData(name string, ver string)
- func SetResultData(name string, result *Result)
- func SetResultsData(r []Result)
- type MetaData
- type Prober
- type Result
- type Stat
- type Status
- func (s *Status) Emoji() string
- func (s Status) MarshalJSON() (b []byte, err error)
- func (s Status) MarshalYAML() (interface{}, error)
- func (s *Status) Status(status string)
- func (s Status) String() string
- func (s Status) Title() string
- func (s *Status) UnmarshalJSON(b []byte) (err error)
- func (s *Status) UnmarshalYAML(unmarshal func(interface{}) error) error
- type StatusCounter
- type StatusHistory
- type TextChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckEmpty ¶ added in v1.3.0
CheckEmpty return "empty" if the string is empty
func CleanData ¶ added in v1.5.0
func CleanData(p []Prober)
CleanData removes the items in resultData not in []Prober Note: No need to consider the thread-safe, because this function is only called once during the startup
func CleanDataFile ¶ added in v1.5.0
CleanDataFile keeps the max backup of data file Note: No need to consider the thread-safe, because this function is only called once during the startup
func LoadDataFromFile ¶ added in v1.5.0
LoadDataFromFile load the results from file Note: No need to consider the thread-safe, because this function is only called once during the startup
func SaveDataToFile ¶ added in v1.5.0
SaveDataToFile save the results to file Note: No need to consider the thread-safe, because this function and SetResultData in same goroutine
func SetMetaData ¶ added in v1.5.0
SetMetaData set the meta data Note: No need to consider the thread-safe, because this function is only called during the startup
func SetResultData ¶ added in v1.5.0
SetResultData set the result of probe Note: this function would be called by status update goroutine
int saveData() in cmd/easeprobe/report.go
func SetResultsData ¶ added in v1.5.0
func SetResultsData(r []Result)
SetResultsData set the results of probe
Types ¶
type MetaData ¶ added in v1.5.0
type MetaData struct { Name string `yaml:"name"` Ver string `yaml:"version"` // contains filtered or unexported fields }
MetaData the meta data of data file
type Prober ¶
type Prober interface { Kind() string Name() string Channels() []string Timeout() time.Duration Interval() time.Duration Result() *Result Config(global.ProbeSettings) error Probe() Result }
Prober Interface
type Result ¶
type Result struct { Name string `json:"name" yaml:"name"` Endpoint string `json:"endpoint" yaml:"endpoint"` StartTime time.Time `json:"time" yaml:"time"` StartTimestamp int64 `json:"timestamp" yaml:"timestamp"` RoundTripTime time.Duration `json:"rtt" yaml:"rtt"` Status Status `json:"status" yaml:"status"` PreStatus Status `json:"prestatus" yaml:"prestatus"` Message string `json:"message" yaml:"message"` LatestDownTime time.Time `json:"latestdowntime" yaml:"latestdowntime"` RecoveryDuration time.Duration `json:"recoverytime" yaml:"recoverytime"` Stat Stat `json:"stat" yaml:"stat"` }
Result is the status of health check
func GetResultData ¶ added in v1.5.0
GetResultData get the result of probe Note: the function would be called by Data Saving, SLA Report, Web Server
func NewResultWithName ¶ added in v1.5.0
NewResultWithName return a Result object with name
func (*Result) DebugJSONIndent ¶ added in v1.2.0
DebugJSONIndent convert the object to indent JSON
func (*Result) SLAPercent ¶ added in v1.6.0
SLAPercent calculate the SLAPercent
type Stat ¶
type Stat struct { Since time.Time `json:"since" yaml:"since"` Total int64 `json:"total" yaml:"total"` Status map[Status]int64 `json:"status" yaml:"status"` UpTime time.Duration `json:"uptime" yaml:"uptime"` DownTime time.Duration `json:"downtime" yaml:"downtime"` StatusCounter }
Stat is the statistics of probe result
type Status ¶
type Status int
Status is the status of Probe
The status of a probe
func (Status) MarshalJSON ¶
MarshalJSON is marshal the status
func (Status) MarshalYAML ¶ added in v1.5.0
MarshalYAML is Marshal the status
func (*Status) UnmarshalJSON ¶
UnmarshalJSON is Unmarshal the status
func (*Status) UnmarshalYAML ¶ added in v1.5.0
UnmarshalYAML is Unmarshal the status
type StatusCounter ¶ added in v1.9.0
type StatusCounter struct { StatusHistory []StatusHistory // the status history MaxLen int // the max length of the status history CurrentStatus bool // the current status StatusCount int // the count of the same status }
StatusCounter is the object to count the status
func NewStatusCounter ¶ added in v1.9.0
func NewStatusCounter(maxLen int) *StatusCounter
NewStatusCounter return a StatusCounter object
func (*StatusCounter) AppendStatus ¶ added in v1.9.0
func (s *StatusCounter) AppendStatus(status bool, message string)
AppendStatus appends the status
func (*StatusCounter) Clone ¶ added in v1.9.0
func (s *StatusCounter) Clone() StatusCounter
Clone returns a copy of the StatusThreshold
func (*StatusCounter) SetMaxLen ¶ added in v1.9.0
func (s *StatusCounter) SetMaxLen(maxLen int)
SetMaxLen sets the max length of the status history
type StatusHistory ¶ added in v1.9.0
StatusHistory is a history of status
type TextChecker ¶ added in v1.7.0
type TextChecker struct { Contain string `yaml:"contain,omitempty" json:"contain,omitempty" jsonschema:"title=Contain Text,description=the string must be contained"` NotContain string `` /* 138-byte string literal not displayed */ RegExp bool `` /* 141-byte string literal not displayed */ // contains filtered or unexported fields }
TextChecker is the struct to check the output
func (*TextChecker) Check ¶ added in v1.7.0
func (tc *TextChecker) Check(Text string) error
Check the text
func (*TextChecker) CheckRegExp ¶ added in v1.7.0
func (tc *TextChecker) CheckRegExp(Output string) error
CheckRegExp checks the output text, - if it contains a configured pattern then return nil - if it does not contain a configured pattern then return nil
func (*TextChecker) CheckText ¶ added in v1.7.0
func (tc *TextChecker) CheckText(Output string) error
CheckText checks the output text, - if it contains a configured string then return nil - if it does not contain a configured string then return nil
func (*TextChecker) Config ¶ added in v1.7.0
func (tc *TextChecker) Config() (err error)
Config the text checker initialize the regexp
func (*TextChecker) String ¶ added in v1.7.0
func (tc *TextChecker) String() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package base is the base package for all probes
|
Package base is the base package for all probes |
Package client is the native client probe package
|
Package client is the native client probe package |
conf
Package conf is the configuration package for native client
|
Package conf is the configuration package for native client |
kafka
Package kafka is the native client probe for kafka.
|
Package kafka is the native client probe for kafka. |
memcache
Package memcache is the native client probe for memcache
|
Package memcache is the native client probe for memcache |
mongo
Package mongo implements a probe client for the MongoDB database.
|
Package mongo implements a probe client for the MongoDB database. |
mysql
Package mysql is the client probe for MySQL.
|
Package mysql is the client probe for MySQL. |
postgres
Package postgres is the native client probe for PostgreSQL
|
Package postgres is the native client probe for PostgreSQL |
redis
Package redis is the native client probe for Redis
|
Package redis is the native client probe for Redis |
zookeeper
Package zookeeper is the zookeeper client probe
|
Package zookeeper is the zookeeper client probe |
Package host is the host probe package
|
Package host is the host probe package |
Package http is the HTTP probe package.
|
Package http is the HTTP probe package. |
Package shell is the shell probe package
|
Package shell is the shell probe package |
Package ssh is the ssh probe package
|
Package ssh is the ssh probe package |
Package tcp is the tcp probe package
|
Package tcp is the tcp probe package |
Package tls is the tls probe package
|
Package tls is the tls probe package |