corechecks

package
v0.0.0-...-395cb8e Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 20 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, checkFactory optional.Option[func() check.Check])

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(integrationConfigDigest uint64, 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 does nothing by default. Override it if your check has background resources that need to be cleaned up when the check is unscheduled.

func (*CheckBase) CommonConfigure

func (c *CheckBase) CommonConfigure(senderManager sender.SenderManager, initConfig, instanceConfig 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(senderManager sender.SenderManager, _ uint64, 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) GetDiagnoses

func (c *CheckBase) GetDiagnoses() ([]diagnosis.Diagnosis, error)

GetDiagnoses returns the diagnoses cached in last run or diagnose explicitly

func (*CheckBase) GetRawSender

func (c *CheckBase) GetRawSender() (sender.Sender, error)

GetRawSender is similar to GetSender, but does not provide the safety wrapper.

func (*CheckBase) GetSender

func (c *CheckBase) GetSender() (sender.Sender, error)

GetSender gets the object to which metrics for this check should be sent.

This is a "safe" sender, specialized to avoid some common errors, at a very small cost to performance. Performance-sensitive checks can use GetRawSender() to avoid this performance cost, as long as they are careful to avoid errors.

See `safesender.go` for details on the managed errors.

func (*CheckBase) GetSenderStats added in v0.9.0

func (c *CheckBase) GetSenderStats() (stats.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() checkid.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) InitConfig

func (c *CheckBase) InitConfig() string

InitConfig returns the init_config configuration for the check.

func (*CheckBase) InstanceConfig

func (c *CheckBase) InstanceConfig() string

InstanceConfig returns the instance configuration for the check.

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

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(senderManger sender.SenderManager, 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

type LongRunningCheck

type LongRunningCheck interface {
	check.Check

	GetSender() (sender.Sender, error)
}

LongRunningCheck is a wrapper that converts a long running check (with Run never terminating) to a typical check in order to be handled in the agent status.

type LongRunningCheckWrapper

type LongRunningCheckWrapper struct {
	LongRunningCheck
	// contains filtered or unexported fields
}

LongRunningCheckWrapper provides a wrapper for long running checks that will be used by the collector to handle the check lifecycle.

func NewLongRunningCheckWrapper

func NewLongRunningCheckWrapper(check LongRunningCheck) *LongRunningCheckWrapper

NewLongRunningCheckWrapper returns a new LongRunningCheckWrapper

func (*LongRunningCheckWrapper) Cancel

func (cw *LongRunningCheckWrapper) Cancel()

Cancel calls the cancel method of the check. It makes sure it is called only once.

func (*LongRunningCheckWrapper) GetSenderStats

func (cw *LongRunningCheckWrapper) GetSenderStats() (stats.SenderStats, error)

GetSenderStats returns the stats from the last run of the check and sets the field LongRunningCheck to true. It is necessary for formatting the stats in the status page.

func (*LongRunningCheckWrapper) Interval

func (cw *LongRunningCheckWrapper) Interval() time.Duration

Interval defines how frequently we should update the metrics. It can't be 0 otherwise the check will be considered as a long running check, Run() will be called only once and the metrics won't be collected.

func (*LongRunningCheckWrapper) Run

func (cw *LongRunningCheckWrapper) Run() error

Run runs the check in a goroutine if it is not already running. If the check is already running, it will commit the sender.

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 ksm implements the Kubernetes State Core cluster check.
Package ksm implements the Kubernetes State Core cluster check.
ksm/customresources
Package customresources implements custom resources that are not yet supported in the kube-state-metrics library or that were supported at some point, but now they're not, and we still want to keep backwards compatibility.
Package customresources implements custom resources that are not yet supported in the kube-state-metrics library or that were supported at some point, but now they're not, and we still want to keep backwards compatibility.
Package containerimage implements the container image check.
Package containerimage implements the container image check.
Package containerlifecycle implements the container lifecycle check.
Package containerlifecycle implements the container lifecycle check.
Package containers provides core checks for containers and orchestrators
Package containers provides core checks for containers and orchestrators
cri
generic
Package generic implements the container check.
Package generic implements the container check.
Package ebpf contains all the ebpf-based checks.
Package ebpf contains all the ebpf-based checks.
oomkill
Package oomkill contains the OOMKill check.
Package oomkill contains the OOMKill check.
probe/ebpfcheck
Package ebpfcheck is the system-probe side of the eBPF check
Package ebpfcheck is the system-probe side of the eBPF check
probe/ebpfcheck/model
Package model is the types for the eBPF check
Package model is the types for the eBPF check
probe/oomkill
Package oomkill is the system-probe side of the OOM Kill check
Package oomkill is the system-probe side of the OOM Kill check
probe/oomkill/model
Package model is the types for the OOM Kill check
Package model is the types for the OOM Kill check
probe/tcpqueuelength
Package tcpqueuelength is the system-probe side of the TCP Queue Length check
Package tcpqueuelength is the system-probe side of the TCP Queue Length check
probe/tcpqueuelength/model
Package model is the types for the TCP Queue Length check
Package model is the types for the TCP Queue Length check
tcpqueuelength
Package tcpqueuelength contains the TCP Queue Length check
Package tcpqueuelength contains the TCP Queue Length check
embed
apm
Package apm provides a stub for the APM check
Package apm provides a stub for the APM check
gpu
Package gpu defines the agent corecheck for the GPU integration
Package gpu defines the agent corecheck for the GPU integration
model
Package model contains the model for the GPU check, with types shared between the system-probe GPU probe and the gpu core agent check
Package model contains the model for the GPU check, with types shared between the system-probe GPU probe and the gpu core agent check
nvidia
Package nvidia holds the logic to collect metrics from the NVIDIA Management Library (NVML).
Package nvidia holds the logic to collect metrics from the NVIDIA Management Library (NVML).
net
Package net provides core checks for networking
Package net provides core checks for networking
ntp
network-devices
cisco-sdwan
Package ciscosdwan implements NDM Cisco SD-WAN corecheck
Package ciscosdwan implements NDM Cisco SD-WAN corecheck
cisco-sdwan/client
Package client implements a Cisco SD-WAN API client
Package client implements a Cisco SD-WAN API client
cisco-sdwan/payload
Package payload implement processing of Cisco SD-WAN api responses
Package payload implement processing of Cisco SD-WAN api responses
cisco-sdwan/report
Package report implements Cisco SD-WAN metadata and metrics reporting
Package report implements Cisco SD-WAN metadata and metrics reporting
Package networkpath defines the agent corecheck for the Network Path integration
Package networkpath defines the agent corecheck for the Network Path integration
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 systemd provides core checks for oracle
Package systemd provides core checks for oracle
Package orchestrator holds orchestrator checks ourside the cluster agent
Package orchestrator holds orchestrator checks ourside the cluster agent
ecs
Package ecs is used for the orchestrator ECS check
Package ecs is used for the orchestrator ECS check
pod
Package pod is used for the orchestrator pod check
Package pod is used for the orchestrator pod check
Package sbom provides core checks for SBOM generation
Package sbom provides core checks for SBOM generation
Package servicediscovery contains the Service Discovery corecheck.
Package servicediscovery contains the Service Discovery corecheck.
apm
Package apm provides functionality to detect the type of APM instrumentation a service is using.
Package apm provides functionality to detect the type of APM instrumentation a service is using.
apm/testutil/instrumented
Package main is a go application which use dd-trace-go, in order to test static APM instrumentation detection.
Package main is a go application which use dd-trace-go, in order to test static APM instrumentation detection.
apm/testutil/instrumented2
Package main is a go application which use dd-trace-go, in order to test static APM instrumentation detection.
Package main is a go application which use dd-trace-go, in order to test static APM instrumentation detection.
envs
Package envs provides target environment variables of interest.
Package envs provides target environment variables of interest.
language
Package language provides functionality to detect the programming language for a given process.
Package language provides functionality to detect the programming language for a given process.
language/reader
Package reader provides utils around io.Reader.
Package reader provides utils around io.Reader.
model
Package model contains types for service discovery.
Package model contains types for service discovery.
module
Package module implements a system-probe Module interface for the discovery component.
Package module implements a system-probe Module interface for the discovery component.
module/testutil/fake_server
Package main is a simple TCP server which accepts any command line arguments, in order to test service discovery which uses the command line for detection.
Package main is a simple TCP server which accepts any command line arguments, in order to test service discovery which uses the command line for detection.
servicetype
Package servicetype provides functionality to detect the service type for a given process.
Package servicetype provides functionality to detect the service type for a given process.
usm
Package usm provides functionality to detect the most appropriate service name for a process.
Package usm provides functionality to detect the most appropriate service name for a process.
Package snmp contains the SNMP corecheck integration
Package snmp contains the SNMP corecheck integration
internal/common
Package common contains constants and basic structures used in snmp integration
Package common contains constants and basic structures used in snmp integration
internal/configvalidation
Package configvalidation contains validation and enrichment functions
Package configvalidation contains validation and enrichment functions
internal/profile
Package profile contains profile related code
Package profile contains profile related code
internal/report
Package report is a package that reports metrics for the device check
Package report is a package that reports metrics for the device check
status
Package status contains the SNMP Profiles status provider
Package status contains the SNMP Profiles status provider
Package system provides core checks for OS-level system metrics
Package system provides core checks for OS-level system metrics
filehandles
Package filehandles defines the file_handle core check
Package filehandles defines the file_handle core check
wincrashdetect
Package wincrashdetect implements the windows crash detection on windows.
Package wincrashdetect implements the windows crash detection on windows.
wincrashdetect/probe
Package probe parses Windows crash dumps.
Package probe parses Windows crash dumps.
Package systemd provides core checks for systemd
Package systemd provides core checks for systemd
Package telemetry is a check to collect and send limited subset of internal telemetry from the core agent.
Package telemetry is a check to collect and send limited subset of internal telemetry from the core agent.

Jump to

Keyboard shortcuts

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