Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrorParamEmpty liberr.CodeError = iota + liberr.MinPkgMonitorCfg ErrorValidatorError )
Variables ¶
This section is empty.
Functions ¶
func DefaultConfig ¶
func SetDefaultConfig ¶
func SetDefaultConfig(cfg []byte)
Types ¶
type Config ¶
type Config struct { // Name define the name of the monitor Name string `json:"name" yaml:"name" toml:"name" mapstructure:"name"` // CheckTimeout define the timeout use for healthcheck. Default is 5 second. CheckTimeout libdur.Duration `json:"check-timeout" yaml:"check-timeout" toml:"check-timeout" mapstructure:"check-timeout"` // IntervalCheck define the time waiting between 2 healthcheck. Default is 5 second. IntervalCheck libdur.Duration `json:"interval-check" yaml:"interval-check" toml:"interval-check" mapstructure:"interval-check"` // IntervalFall define the time waiting between 2 healthcheck when last check is KO. Default is 5 second. IntervalFall libdur.Duration `json:"interval-fall" yaml:"interval-fall" toml:"interval-fall" mapstructure:"interval-down"` // IntervalRise define the time waiting between 2 healthcheck when status is KO or Warn but last check is OK. Default is 5 second. IntervalRise libdur.Duration `json:"interval-rise" yaml:"interval-rise" toml:"interval-rise" mapstructure:"interval-rise"` // FallCountKO define the number of KO before considerate the component as down. FallCountKO uint8 `json:"fall-count-ko" yaml:"fall-count-ko" toml:"fall-count-ko" mapstructure:"fall-count-ko"` // FallCountWarn define the number of KO before considerate the component as warn. FallCountWarn uint8 `json:"fall-count-warn" yaml:"fall-count-warn" toml:"fall-count-warn" mapstructure:"fall-count-warn"` // RiseCountKO define the number of OK when status is KO before considerate the component as up. RiseCountKO uint8 `json:"rise-count-ko" yaml:"rise-count-ko" toml:"rise-count-ko" mapstructure:"rise-count-ko"` // RiseCountWarn define the number of OK when status is Warn before considerate the component as up. RiseCountWarn uint8 `json:"rise-count-warn" yaml:"rise-count-warn" toml:"rise-count-warn" mapstructure:"rise-count-warn"` // Logger define the logger options for current monitor log Logger logcfg.Options `json:"logger" yaml:"logger" toml:"logger" mapstructure:"logger"` }
type HealthCheck ¶
type Monitor ¶
type Monitor interface { MonitorInfo MonitorStatus MonitorMetrics libsrv.Server // SetConfig is used to set or update config of the monitor SetConfig(ctx libctx.FuncContext, cfg Config) liberr.Error // RegisterLoggerDefault is used to define the default logger. // Default logger can be used to extend options logger from it RegisterLoggerDefault(fct liblog.FuncLog) // GetConfig is used to retrieve config of the monitor GetConfig() Config // SetHealthCheck is used to set or update the healthcheck func SetHealthCheck(fct HealthCheck) // GetHealthCheck is used to retrieve the healthcheck func GetHealthCheck() HealthCheck // Clone is used to clone monitor to another standalone instance Clone(ctx context.Context) (Monitor, liberr.Error) }
type MonitorInfo ¶
type MonitorMetrics ¶
type MonitorMetrics interface { RegisterMetricsName(names ...string) RegisterMetricsAddName(names ...string) RegisterCollectMetrics(fct libprm.FuncCollectMetrics) CollectLatency() time.Duration CollectUpTime() time.Duration CollectDownTime() time.Duration CollectRiseTime() time.Duration CollectFallTime() time.Duration CollectStatus() (sts monsts.Status, rise bool, fall bool) }
type MonitorStatus ¶
type MonitorStatus interface { encoding.TextMarshaler json.Marshaler // Name return the name of the monitor. Name() string // Status return the last status (OK / Warn / KO). Status() monsts.Status // Message return the last error, warning, message of the last status Message() string // IsRise return true if rising status from KO or Warn IsRise() bool // IsFall return true if falling status to KO or Warn IsFall() bool // Latency return the last check's latency Latency() time.Duration // Uptime return the total duration of uptime (OK status) Uptime() time.Duration // Downtime return the total duration of downtime (KO status) Downtime() time.Duration }
type Pool ¶
type Pool interface { PoolStatus PoolShell }
type PoolManage ¶ added in v1.11.3
type PoolStatus ¶
type PoolStatus interface { encoding.TextMarshaler json.Marshaler PoolManage }
Click to show internal directories.
Click to hide internal directories.