corechecks

package
v0.0.0-...-1d9613f Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRegisteredFactoryKeys

func GetRegisteredFactoryKeys() []string

GetRegisteredFactoryKeys get the keys for all registered factories

func RegisterCheck

func RegisterCheck(name string, c CheckFactory)

RegisterCheck adds a check to the catalog

Types

type CheckBase

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

CheckBase provides default implementations for most of the check.Check interface to make it easier to bootstrap a new corecheck.

To use it, you need to embed it in your check struct, by calling NewCheckBase() in your factory, plus: - long-running checks must override Stop() and Interval() - checks supporting multiple instances must call BuildID() from their Config() method

Integration warnings are handled via the Warn and Warnf methods that forward the warning to the logger and send the warning to the collector for display in the status page and the web UI.

func NewCheckBase

func NewCheckBase(name string) CheckBase

NewCheckBase returns a check base struct with a given check name

func (*CheckBase) BuildID

func (c *CheckBase) BuildID(instance, initConfig check.ConfigData)

BuildID is to be called by the check's Config() method to generate the unique check ID.

func (*CheckBase) GetMetricStats

func (c *CheckBase) GetMetricStats() (map[string]int64, error)

GetMetricStats returns the stats from the last run of the check.

func (*CheckBase) GetWarnings

func (c *CheckBase) GetWarnings() []error

GetWarnings grabs the latest integration warnings for the check.

func (*CheckBase) ID

func (c *CheckBase) ID() check.ID

ID returns a unique ID for that check instance

For checks that only support one instance, the default value is the check name. Regular checks must call BuildID() from Config() to build their ID.

func (*CheckBase) Interval

func (c *CheckBase) Interval() time.Duration

Interval returns the scheduling time for the check. Long-running checks should override to return 0.

func (*CheckBase) Stop

func (c *CheckBase) Stop()

Stop does nothing by default, you need to implement it in long-running checks (persisting after Run() exits)

func (*CheckBase) String

func (c *CheckBase) String() string

String returns the name of the check, the same for every instance

func (*CheckBase) Warn

func (c *CheckBase) Warn(v ...interface{}) error

Warn sends an integration warning to logs + agent status.

func (*CheckBase) Warnf

func (c *CheckBase) Warnf(format string, params ...interface{}) error

Warnf sends an integration warning to logs + agent status.

type CheckFactory

type CheckFactory func() check.Check

CheckFactory factory function type to instantiate checks

func GetCheckFactory

func GetCheckFactory(name string) CheckFactory

GetCheckFactory grabs factory for specific check

type GoCheckLoader

type GoCheckLoader struct{}

GoCheckLoader is a specific loader for checks living in this package

func NewGoCheckLoader

func NewGoCheckLoader() (*GoCheckLoader, error)

NewGoCheckLoader creates a loader for go checks

func (*GoCheckLoader) Load

func (gl *GoCheckLoader) Load(config check.Config) ([]check.Check, error)

Load returns a list of checks, one for every configuration instance found in `config`

func (*GoCheckLoader) String

func (gl *GoCheckLoader) String() string

Directories

Path Synopsis
Package cluster provides core checks for cluster level checks, used by the Datadog Cluster Agent.
Package cluster provides core checks for cluster level checks, used by the Datadog Cluster Agent.
Package containers provides core checks for containers and orchestrators
Package containers provides core checks for containers and orchestrators
Package network provides core checks for networking
Package network provides core checks for networking

Jump to

Keyboard shortcuts

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