plugins

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownCheckerType = errors.New("Unknown checker name")

ErrUnknownCheckerType is the error returned when the factory can't create a checker because type is not registered

Functions

func Register

func Register(name string, factory CheckerFactory)

Register will be use to register a new checker from a name and a factory function

func RenderError added in v1.1.0

func RenderError(tmpl *template.Template, model interface{}) string

RenderError allow personalised rendering if checker contains a template

Types

type Checker

type Checker interface {
	Name() string
	ServiceName() string
	Periodicity() *time.Duration
	Run(context.Context) Result
}

Checker is the interface that allow to perform checks

func CreateChecker

func CreateChecker(name string, checkerCfg interface{}, pluginCfg interface{}) (Checker, error)

CreateChecker instantiates registered checker into a single instance

type CheckerFactory

type CheckerFactory func(checkerCfg interface{}, pluginCfg interface{}) (Checker, error)

CheckerFactory is the function interface to creates a checker instance

type Result

type Result struct {
	// Status indicates if check was successful or not
	Status StatusEnum
	// Message is the additional message that can be given to Consumer server
	Message string
	// Checker is the checker that returns this result
	Checker Checker
}

Result is the structure that represents a checker result

func ResultFromError added in v1.1.0

func ResultFromError(checker Checker, err error, prefix string) Result

ResultFromError generates a critical result from a checker and an error

type StatusEnum

type StatusEnum int16

StatusEnum corresponds to all status for a Consumer message

const (
	// STATE_OK represents a healthy service
	STATE_OK StatusEnum = nsca.STATE_OK
	// STATE_WARNING represents a service that requires attention
	STATE_WARNING StatusEnum = nsca.STATE_WARNING
	// STATE_CRITICAL represents a service that needs immediate fix
	STATE_CRITICAL StatusEnum = nsca.STATE_CRITICAL
	// STATE_UNKNOWN represents a service in an unsure status
	STATE_UNKNOWN StatusEnum = nsca.STATE_UNKNOWN
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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