check

package
v0.0.0-...-b19e04c Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerCheck

type ContainerCheck struct {
	// contains filtered or unexported fields
}

func NewContainerStopped

func NewContainerStopped(
	address string,
	tcpAddresses []string,
	persistenConnection bool,
	labels map[string]string,
	annotations types.MetricAnnotations,
) *ContainerCheck

func (ContainerCheck) Check

func (bc ContainerCheck) Check(ctx context.Context, scheduleUpdate func(runAt time.Time)) types.MetricPoint

Check runs the Check and returns the resulting point. If the Check is successful, it ensures the sockets are opened. If the fails, it ensures the sockets are closed. If it fails for the first time (ok -> critical), a new Check will be scheduled sooner.

func (ContainerCheck) Close

func (bc ContainerCheck) Close()

func (ContainerCheck) DiagnosticArchive

func (bc ContainerCheck) DiagnosticArchive(_ context.Context, archive types.ArchiveWriter) error

type Gatherer

type Gatherer struct {
	// contains filtered or unexported fields
}

Gatherer is the gatherer used for service checks.

func NewCheckGatherer

func NewCheckGatherer(check checker) *Gatherer

NewCheckGatherer returns a new check gatherer.

func (*Gatherer) CheckNow

func (cg *Gatherer) CheckNow(ctx context.Context) types.StatusDescription

CheckNow runs the check and returns its status.

func (*Gatherer) Close

func (cg *Gatherer) Close()

func (*Gatherer) DiagnosticArchive

func (cg *Gatherer) DiagnosticArchive(ctx context.Context, archive types.ArchiveWriter) error

func (*Gatherer) Gather

func (cg *Gatherer) Gather() ([]*dto.MetricFamily, error)

Gather runs the check and returns the result as metric families.

func (*Gatherer) GatherWithState

func (cg *Gatherer) GatherWithState(ctx context.Context, state registry.GatherState) ([]*dto.MetricFamily, error)

GatherWithState implements GathererWithState.

func (*Gatherer) SetScheduleUpdate

func (cg *Gatherer) SetScheduleUpdate(scheduleUpdate func(runAt time.Time))

SetScheduleUpdate implements GathererWithScheduleUpdate.

type HTTPCheck

type HTTPCheck struct {
	// contains filtered or unexported fields
}

HTTPCheck perform a HTTP check.

func NewHTTP

func NewHTTP(
	urlValue string,
	httpHost string,
	persistentAddresses []string,
	persistentConnection bool,
	expectedStatusCode int,
	labels map[string]string,
	annotations types.MetricAnnotations,
) *HTTPCheck

NewHTTP create a new HTTP check.

For each persistentAddresses (in the format "IP:port") this checker will maintain a TCP connection open, if broken (and unable to re-open), the check will be immediately run.

If expectedStatusCode is 0, StatusCode below 400 will generate Ok, between 400 and 499 => warning and above 500 => critical If expectedStatusCode is not 0, StatusCode must match the value or result will be critical.

func (HTTPCheck) Check

func (bc HTTPCheck) Check(ctx context.Context, scheduleUpdate func(runAt time.Time)) types.MetricPoint

Check runs the Check and returns the resulting point. If the Check is successful, it ensures the sockets are opened. If the fails, it ensures the sockets are closed. If it fails for the first time (ok -> critical), a new Check will be scheduled sooner.

func (HTTPCheck) Close

func (bc HTTPCheck) Close()

func (*HTTPCheck) DiagnosticArchive

func (hc *HTTPCheck) DiagnosticArchive(ctx context.Context, archive types.ArchiveWriter) error

type NTPCheck

type NTPCheck struct {
	// contains filtered or unexported fields
}

NTPCheck perform a NTP check.

func NewNTP

func NewNTP(
	address string,
	persistentAddresses []string,
	persistentConnection bool,
	labels map[string]string,
	annotations types.MetricAnnotations,
) *NTPCheck

NewNTP create a new NTP check.

All addresses use the format "IP:port".

For each persistentAddresses this checker will maintain a TCP connection open, if broken (and unable to re-open), the check will be immediately run.

func (NTPCheck) Check

func (bc NTPCheck) Check(ctx context.Context, scheduleUpdate func(runAt time.Time)) types.MetricPoint

Check runs the Check and returns the resulting point. If the Check is successful, it ensures the sockets are opened. If the fails, it ensures the sockets are closed. If it fails for the first time (ok -> critical), a new Check will be scheduled sooner.

func (NTPCheck) Close

func (bc NTPCheck) Close()

func (NTPCheck) DiagnosticArchive

func (bc NTPCheck) DiagnosticArchive(_ context.Context, archive types.ArchiveWriter) error

type NagiosCheck

type NagiosCheck struct {
	// contains filtered or unexported fields
}

NagiosCheck perform a Nagios check.

func NewNagios

func NewNagios(
	nagiosCommand string,
	persistentAddresses []string,
	persistentConnection bool,
	labels map[string]string,
	annotations types.MetricAnnotations,
) *NagiosCheck

NewNagios create a new Nagios check.

For each persistentAddresses (in the format "IP:port") this checker will maintain a TCP connection open, if broken (and unable to re-open), the check will be immediately run.

func (NagiosCheck) Check

func (bc NagiosCheck) Check(ctx context.Context, scheduleUpdate func(runAt time.Time)) types.MetricPoint

Check runs the Check and returns the resulting point. If the Check is successful, it ensures the sockets are opened. If the fails, it ensures the sockets are closed. If it fails for the first time (ok -> critical), a new Check will be scheduled sooner.

func (NagiosCheck) Close

func (bc NagiosCheck) Close()

func (NagiosCheck) DiagnosticArchive

func (bc NagiosCheck) DiagnosticArchive(_ context.Context, archive types.ArchiveWriter) error

type ProcessCheck

type ProcessCheck struct {
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(
	matchProcess string,
	labels map[string]string,
	annotations types.MetricAnnotations,
	ps processProvider,
) (*ProcessCheck, error)

func (ProcessCheck) Check

func (bc ProcessCheck) Check(ctx context.Context, scheduleUpdate func(runAt time.Time)) types.MetricPoint

Check runs the Check and returns the resulting point. If the Check is successful, it ensures the sockets are opened. If the fails, it ensures the sockets are closed. If it fails for the first time (ok -> critical), a new Check will be scheduled sooner.

func (ProcessCheck) Close

func (bc ProcessCheck) Close()

func (ProcessCheck) DiagnosticArchive

func (bc ProcessCheck) DiagnosticArchive(_ context.Context, archive types.ArchiveWriter) error

type SMTPCheck

type SMTPCheck struct {
	// contains filtered or unexported fields
}

SMTPCheck perform a SMTP check.

func NewSMTP

func NewSMTP(
	address string,
	persistentAddresses []string,
	persistentConnection bool,
	labels map[string]string,
	annotations types.MetricAnnotations,
) *SMTPCheck

NewSMTP create a new SMTP check.

All addresses use the format "IP:port".

For each persistentAddresses this checker will maintain a TCP connection open, if broken (and unable to re-open), the check will be immediately run.

func (SMTPCheck) Check

func (bc SMTPCheck) Check(ctx context.Context, scheduleUpdate func(runAt time.Time)) types.MetricPoint

Check runs the Check and returns the resulting point. If the Check is successful, it ensures the sockets are opened. If the fails, it ensures the sockets are closed. If it fails for the first time (ok -> critical), a new Check will be scheduled sooner.

func (SMTPCheck) Close

func (bc SMTPCheck) Close()

func (SMTPCheck) DiagnosticArchive

func (bc SMTPCheck) DiagnosticArchive(_ context.Context, archive types.ArchiveWriter) error

type TCPCheck

type TCPCheck struct {
	// contains filtered or unexported fields
}

TCPCheck perform a TCP check.

func NewTCP

func NewTCP(
	address string,
	tcpAddresses []string,
	persistentConnection bool,
	send []byte,
	expect []byte,
	closeMsg []byte,
	labels map[string]string,
	annotations types.MetricAnnotations,
) *TCPCheck

NewTCP create a new TCP check.

All addresses use the format "IP:port".

If set, on the main address it will send specified byte and expect the specified byte.

On tcpAddresses (which are supposed to contains addresse) a TCP connection is openned and closed on each check.

If persistentConnection is set, a persistent TCP connection will be openned to detect service incident quickyl.

func (TCPCheck) Check

func (bc TCPCheck) Check(ctx context.Context, scheduleUpdate func(runAt time.Time)) types.MetricPoint

Check runs the Check and returns the resulting point. If the Check is successful, it ensures the sockets are opened. If the fails, it ensures the sockets are closed. If it fails for the first time (ok -> critical), a new Check will be scheduled sooner.

func (TCPCheck) Close

func (bc TCPCheck) Close()

func (TCPCheck) DiagnosticArchive

func (bc TCPCheck) DiagnosticArchive(_ context.Context, archive types.ArchiveWriter) error

Jump to

Keyboard shortcuts

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