modules

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2015 License: Apache-2.0 Imports: 8 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHttpProbe

func NewHttpProbe() *httpProbe

Types

type ProbeData

type ProbeData struct {
	IsUp        *float64     // Indicates the success/failure of the probe.
	PayloadSize *float64     // Optional. Response payload size.
	Latency     *float64     // Latency in milli seconds.
	StartTime   *int64       // Unix epoch in nano seconds.
	EndTime     *int64       // Unix epoch in nano seconds.
	Headers     *http.Header // Optional, primarily for the http module.
	Payload     *[]byte      // Optional.
}

Probedata is the struct which holds the probe response info.

type Prober

type Prober interface {
	// Prepare is used to set up the probe module. Use it to do custom initialization.
	// Prepare is guranteed to be called before executing the Run() method of the module.
	Prepare() error

	// Run runs the probe. It will be called in a loop. This is the most import method of the interface.
	// Implementation should send the probe response data using the ProbeData struct.
	// In case of any error, the same should be send via the error channel. The response channel
	// should not be used in error situations.
	Run(chan<- *ProbeData, chan<- error)

	// Name returns the name of the probe.
	Name() *string

	// TimeoutSecs returns the timeout for a given probe.
	TimeoutSecs() *int

	// RunIntervalSecs returns the frequency of the probe.
	RunIntervalSecs() *int

	// RetConfig returns the config values of the probe module. This will be used in the http ui.
	RetConfig() string
}

Prober is the interface that a probe module needs to implement.

type TestProbe

type TestProbe struct {
	ProbeName     *string `json:"probe_name"`
	ProbeInterval *int    `json:"probe_interval"`
	ProbeTimeout  *int    `json:"probe_timeout"`
	ProbeMyConfig *string `json:"probe_my_config"` // this config field is specific to this module.
}

func (*TestProbe) Name

func (t *TestProbe) Name() *string

func (*TestProbe) Prepare

func (t *TestProbe) Prepare() error

func (*TestProbe) RetConfig

func (t *TestProbe) RetConfig() string

func (*TestProbe) Run

func (t *TestProbe) Run(respCh chan<- *ProbeData, errCh chan<- error)

func (*TestProbe) RunIntervalSecs

func (t *TestProbe) RunIntervalSecs() *int

func (*TestProbe) TimeoutSecs

func (t *TestProbe) TimeoutSecs() *int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL