monitor

package
v0.0.0-...-d82a759 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(resource config.Resource) int

Fetch fetches the configured resource and gives back the HTTP response code

func Monitor

func Monitor(resources []config.Resource) <-chan *StateChangeMessage

Monitor takes a resource and polls the given HTTP url for errors , and emits failure / recovery messages accordingly

Types

type StateChangeMessage

type StateChangeMessage struct {
	Resource config.Resource
	IsOk     bool
	Codes    []int
	Datetime time.Time
}

StateChangeMessage represents either a failure or a recovery

func ErrorMessage

func ErrorMessage(resource config.Resource, codes []int) *StateChangeMessage

ErrorMessage initializes a message with Time.Now() as the creation date and IsOk = false

func RecoveryMessage

func RecoveryMessage(resource config.Resource, codes []int) *StateChangeMessage

NewMessage initializes a message with Time.Now() as the creation date and IsOk = true

func (*StateChangeMessage) MailBody

func (m *StateChangeMessage) MailBody() string

func (*StateChangeMessage) MailSubject

func (m *StateChangeMessage) MailSubject() string

func (*StateChangeMessage) String

func (m *StateChangeMessage) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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