corechecks

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 10 Imported by: 10

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 Configure() method - after optionally building a unique ID, CommonConfigure() must be called from the Config() method to handle the common instance fields

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.

If custom tags are set in the instance configuration, they will be automatically appended to each send done by this check.

func NewCheckBase

func NewCheckBase(name string) CheckBase

NewCheckBase returns a check base struct with a given check name

func NewCheckBaseWithInterval

func NewCheckBaseWithInterval(name string, defaultInterval time.Duration) CheckBase

NewCheckBaseWithInterval returns a check base struct with a given check name and interval

func (*CheckBase) BuildID

func (c *CheckBase) BuildID(instance, initConfig integration.Data)

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

func (*CheckBase) Cancel added in v0.9.0

func (c *CheckBase) Cancel()

Cancel calls CommonCancel by default. Override it if your check has background resources that need to be cleaned up when the check is unscheduled. Make sure to call CommonCancel from your override.

func (*CheckBase) CommonCancel added in v0.9.0

func (c *CheckBase) CommonCancel()

CommonCancel cleans up common resources. Must be called from Cancel when checks implement it.

func (*CheckBase) CommonConfigure

func (c *CheckBase) CommonConfigure(instance integration.Data, source string) error

CommonConfigure is called when checks implement their own Configure method, in order to setup common options (run interval, empty hostname)

func (*CheckBase) ConfigSource

func (c *CheckBase) ConfigSource() string

ConfigSource returns an empty string as Go check can't be updated independently from the agent

func (*CheckBase) Configure

func (c *CheckBase) Configure(data integration.Data, initConfig integration.Data, source string) error

Configure is provided for checks that require no config. If overridden, the call to CommonConfigure must be preserved.

func (*CheckBase) GetSenderStats added in v0.9.0

func (c *CheckBase) GetSenderStats() (check.SenderStats, error)

GetSenderStats 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) IsTelemetryEnabled

func (c *CheckBase) IsTelemetryEnabled() bool

IsTelemetryEnabled returns if the telemetry is enabled for this check.

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) Version

func (c *CheckBase) Version() string

Version returns an empty string as Go check can't be updated independently from the agent

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 integration.Config, instance integration.Data) (check.Check, error)

Load returns a Go check

func (*GoCheckLoader) Name added in v0.9.0

func (gl *GoCheckLoader) Name() string

Name return returns Go loader name

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.
ksm
Package containers provides core checks for containers and orchestrators
Package containers provides core checks for containers and orchestrators
cri
jmx
Package net provides core checks for networking
Package net provides core checks for networking
nvidia
jetson
Package nvidia provides core checks for Nvidia's jetson device family
Package nvidia provides core checks for Nvidia's jetson device family
Package system provides core checks for OS-level system metrics
Package system provides core checks for OS-level system metrics
cpu
Package systemd provides core checks for systemd
Package systemd provides core checks for systemd

Jump to

Keyboard shortcuts

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