checks

package
v0.0.0-...-7983b3b Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Connections is a singleton ConnectionsCheck.
	Connections = &ConnectionsCheck{}

	// LocalResolver is a singleton LocalResolver
	LocalResolver = &resolver.LocalResolver{}

	// ErrTracerStillNotInitialized signals that the tracer is _still_ not ready, so we shouldn't log additional errors
	ErrTracerStillNotInitialized = errors.New("remote tracer is still not initialized")
)

All is a list of all runnable checks. Putting a check in here does not guarantee it will be run, it just guarantees that the collector will be able to find the check. If you want to add a check you MUST register it here.

View Source
var Container = &ContainerCheck{}

Container is a singleton ContainerCheck.

View Source
var Pod = &PodCheck{}

Pod is a singleton PodCheck.

View Source
var Process = &ProcessCheck{}

Process is a singleton ProcessCheck.

View Source
var ProcessDiscovery = &ProcessDiscoveryCheck{}

ProcessDiscovery is a ProcessDiscoveryCheck singleton. ProcessDiscovery should not be instantiated elsewhere.

View Source
var RTContainer = &RTContainerCheck{}

RTContainer is a singleton RTContainerCheck.

Functions

func CollectSystemInfo

func CollectSystemInfo(cfg *config.AgentConfig) (*model.SystemInfo, error)

CollectSystemInfo collects a set of system-level information that will not change until a restart. This bit of information should be passed along with the process messages.

func NewRunnerWithRealTime

func NewRunnerWithRealTime(config RunnerConfig) (func(), error)

NewRunnerWithRealTime creates a runner func for CheckWithRealTime

Types

type Check

type Check interface {
	Init(cfg *config.AgentConfig, info *model.SystemInfo)
	Name() string
	RealTime() bool
	Run(cfg *config.AgentConfig, groupID int32) ([]model.MessageBody, error)
}

Check is an interface for Agent checks that collect data. Each check returns a specific MessageBody type that will be published to the intake endpoint or processed in another way (e.g. printed for debugging). Before checks are used you must called Init.

type CheckWithRealTime

type CheckWithRealTime interface {
	Check
	RealTimeName() string
	RunWithOptions(cfg *config.AgentConfig, nextGroupID func() int32, options RunOptions) (*RunResult, error)
}

CheckWithRealTime provides an extended interface for running composite checks

type ConnectionsCheck

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

ConnectionsCheck collects statistics about live TCP and UDP connections.

func (*ConnectionsCheck) Init

Init initializes a ConnectionsCheck instance.

func (*ConnectionsCheck) Name

func (c *ConnectionsCheck) Name() string

Name returns the name of the ConnectionsCheck.

func (*ConnectionsCheck) RealTime

func (c *ConnectionsCheck) RealTime() bool

RealTime indicates if this check only runs in real-time mode.

func (*ConnectionsCheck) Run

func (c *ConnectionsCheck) Run(cfg *config.AgentConfig, groupID int32) ([]model.MessageBody, error)

Run runs the ConnectionsCheck to collect the live TCP connections on the system. Currently only linux systems are supported as eBPF is used to gather this information. For each connection we'll return a `model.Connection` that will be bundled up into a `CollectorConnections`. See agent.proto for the schema of the message and models.

type ContainerCheck

type ContainerCheck struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ContainerCheck is a check that returns container metadata and stats.

func (*ContainerCheck) Init

func (c *ContainerCheck) Init(cfg *config.AgentConfig, info *model.SystemInfo)

Init initializes a ContainerCheck instance.

func (*ContainerCheck) Name

func (c *ContainerCheck) Name() string

Name returns the name of the ProcessCheck.

func (*ContainerCheck) RealTime

func (c *ContainerCheck) RealTime() bool

RealTime indicates if this check only runs in real-time mode.

func (*ContainerCheck) Run

func (c *ContainerCheck) Run(cfg *config.AgentConfig, groupID int32) ([]model.MessageBody, error)

Run runs the ContainerCheck to collect a list of running ctrList and the stats for each container.

type PodCheck

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

PodCheck is a check that returns container metadata and stats.

func (*PodCheck) Init

func (c *PodCheck) Init(cfg *config.AgentConfig, info *model.SystemInfo)

Init initializes a PodCheck instance.

func (*PodCheck) Name

func (c *PodCheck) Name() string

Name returns the name of the ProcessCheck.

func (*PodCheck) RealTime

func (c *PodCheck) RealTime() bool

RealTime indicates if this check only runs in real-time mode.

func (*PodCheck) Run

func (c *PodCheck) Run(cfg *config.AgentConfig, groupID int32) ([]model.MessageBody, error)

Run runs the PodCheck to collect a list of running pods

type ProcessCheck

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

ProcessCheck collects full state, including cmdline args and related metadata, for live and running processes. The instance will store some state between checks that will be used for rates, cpu calculations, etc.

func (*ProcessCheck) Init

func (p *ProcessCheck) Init(cfg *config.AgentConfig, info *model.SystemInfo)

Init initializes the singleton ProcessCheck.

func (*ProcessCheck) Name

func (p *ProcessCheck) Name() string

Name returns the name of the ProcessCheck.

func (*ProcessCheck) RealTime

func (p *ProcessCheck) RealTime() bool

RealTime indicates if this check only runs in real-time mode.

func (*ProcessCheck) RealTimeName

func (p *ProcessCheck) RealTimeName() string

RealTimeName returns the name of the RTProcessCheck

func (*ProcessCheck) Run

func (p *ProcessCheck) Run(cfg *config.AgentConfig, groupID int32) ([]model.MessageBody, error)

Run runs the ProcessCheck to collect a list of running processes and relevant stats for each. On most POSIX systems this will use a mix of procfs and other OS-specific APIs to collect this information. The bulk of this collection is abstracted into the `gopsutil` library. Processes are split up into a chunks of at most 100 processes per message to limit the message size on intake. See agent.proto for the schema of the message and models used.

func (*ProcessCheck) RunWithOptions

func (p *ProcessCheck) RunWithOptions(cfg *config.AgentConfig, nextGroupID func() int32, options RunOptions) (*RunResult, error)

RunWithOptions collects process data (regular metadata + stats) and/or realtime process data (stats only) Messages are grouped as RunResult instances with CheckName identifying the type

type ProcessDiscoveryCheck

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

ProcessDiscoveryCheck is a check that gathers basic process metadata. It uses its own ProcessDiscovery payload. The goal of this check is to collect information about possible integrations that may be enabled by the end user.

func (*ProcessDiscoveryCheck) Init

Init initializes the ProcessDiscoveryCheck. It is a runtime error to call Run without first having called Init.

func (*ProcessDiscoveryCheck) Name

func (d *ProcessDiscoveryCheck) Name() string

Name returns the name of the ProcessDiscoveryCheck.

func (*ProcessDiscoveryCheck) RealTime

func (d *ProcessDiscoveryCheck) RealTime() bool

RealTime returns a value that says whether this check should be run in real time.

func (*ProcessDiscoveryCheck) Run

Run collects process metadata, and packages it into a CollectorProcessDiscovery payload to be sent. It is a runtime error to call Run without first having called Init.

type RTContainerCheck

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

RTContainerCheck collects numeric statistics about live ctrList.

func (*RTContainerCheck) Init

func (r *RTContainerCheck) Init(_ *config.AgentConfig, sysInfo *model.SystemInfo)

Init initializes a RTContainerCheck instance.

func (*RTContainerCheck) Name

func (r *RTContainerCheck) Name() string

Name returns the name of the RTContainerCheck.

func (*RTContainerCheck) RealTime

func (r *RTContainerCheck) RealTime() bool

RealTime indicates if this check only runs in real-time mode.

func (*RTContainerCheck) Run

func (r *RTContainerCheck) Run(cfg *config.AgentConfig, groupID int32) ([]model.MessageBody, error)

Run runs the real-time container check getting container-level stats from the Cgroups and Docker APIs.

type RunOptions

type RunOptions struct {
	RunStandard bool
	RunRealTime bool
}

RunOptions provides run options for checks

type RunResult

type RunResult struct {
	Standard []model.MessageBody
	RealTime []model.MessageBody
}

RunResult is a result for a check run

type RunnerConfig

type RunnerConfig struct {
	CheckInterval time.Duration
	RtInterval    time.Duration

	ExitChan       chan struct{}
	RtIntervalChan chan time.Duration
	RtEnabled      func() bool
	RunCheck       func(options RunOptions)
}

RunnerConfig implements config for runners that work with CheckWithRealTime

Jump to

Keyboard shortcuts

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