Documentation ¶
Overview ¶
Package base is the base package for all probes
Index ¶
- Constants
- type DefaultProbe
- func (d *DefaultProbe) Channels() []string
- func (d *DefaultProbe) CheckStatusThreshold() probe.Status
- func (d *DefaultProbe) Config(gConf global.ProbeSettings, kind, tag, name, endpoint string, fn ProbeFuncType) error
- func (d *DefaultProbe) DownTimeCalculation(status probe.Status)
- func (d *DefaultProbe) ExportMetrics()
- func (d *DefaultProbe) GetProxyConnection(socks5 string, host string) (net.Conn, error)
- func (d *DefaultProbe) Interval() time.Duration
- func (d *DefaultProbe) Kind() string
- func (d *DefaultProbe) LabelMap() prometheus.Labels
- func (d *DefaultProbe) LogTitle() string
- func (d *DefaultProbe) Name() string
- func (d *DefaultProbe) Probe() probe.Result
- func (d *DefaultProbe) Result() *probe.Result
- func (d *DefaultProbe) SetLabelMap(labels prometheus.Labels)
- func (d *DefaultProbe) Timeout() time.Duration
- type ProbeFuncType
Constants ¶
const ( ServiceUp int = 1 ServiceDown int = 0 )
Probe Simple Status
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultProbe ¶
type DefaultProbe struct { ProbeKind string `yaml:"-" json:"-"` ProbeTag string `yaml:"-" json:"-"` ProbeName string `yaml:"name" json:"name" jsonschema:"required,title=Probe Name,description=the name of probe must be unique"` ProbeChannels []string `` /* 133-byte string literal not displayed */ ProbeTimeout time.Duration `` /* 143-byte string literal not displayed */ ProbeTimeInterval time.Duration `` /* 147-byte string literal not displayed */ Labels prometheus.Labels `yaml:"labels,omitempty" json:"labels,omitempty" jsonschema:"title=Probe LabelMap,description=the labels of probe"` global.StatusChangeThresholdSettings `yaml:",inline" json:",inline"` global.NotificationStrategySettings `yaml:"alert" json:"alert" jsonschema:"title=Probe Alert,description=the alert strategy of probe"` ProbeFunc ProbeFuncType `yaml:"-" json:"-"` ProbeResult *probe.Result `yaml:"-" json:"-"` // contains filtered or unexported fields }
DefaultProbe is the default options for all probe
func (*DefaultProbe) Channels ¶
func (d *DefaultProbe) Channels() []string
Channels return the probe channels
func (*DefaultProbe) CheckStatusThreshold ¶
func (d *DefaultProbe) CheckStatusThreshold() probe.Status
CheckStatusThreshold check the status threshold
func (*DefaultProbe) Config ¶
func (d *DefaultProbe) Config(gConf global.ProbeSettings, kind, tag, name, endpoint string, fn ProbeFuncType) error
Config default config
func (*DefaultProbe) DownTimeCalculation ¶
func (d *DefaultProbe) DownTimeCalculation(status probe.Status)
DownTimeCalculation calculate the down time
func (*DefaultProbe) ExportMetrics ¶
func (d *DefaultProbe) ExportMetrics()
ExportMetrics export the metrics
func (*DefaultProbe) GetProxyConnection ¶
GetProxyConnection return the proxy connection
func (*DefaultProbe) Interval ¶
func (d *DefaultProbe) Interval() time.Duration
Interval get the probe interval
func (*DefaultProbe) LabelMap ¶
func (d *DefaultProbe) LabelMap() prometheus.Labels
LabelMap return the const metric labels for a probe in the configuration.
func (*DefaultProbe) LogTitle ¶
func (d *DefaultProbe) LogTitle() string
LogTitle return the log title
func (*DefaultProbe) Probe ¶
func (d *DefaultProbe) Probe() probe.Result
Probe return the checking result
func (*DefaultProbe) Result ¶
func (d *DefaultProbe) Result() *probe.Result
Result get the probe result
func (*DefaultProbe) SetLabelMap ¶
func (d *DefaultProbe) SetLabelMap(labels prometheus.Labels)
SetLabelMap set a set of new labels for a probe.
Note: This method takes effect before Probe.Config() only
func (*DefaultProbe) Timeout ¶
func (d *DefaultProbe) Timeout() time.Duration
Timeout get the probe timeout
type ProbeFuncType ¶
ProbeFuncType is the probe function type