agent

package
v0.3.0-rc.53 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agent is beacon-probe's push mode, the whole probe agent in one process: every interval it fetches what to check from the gateway (its targets and the module file, cached on disk for when the gateway cannot be reached), probes every target, reads the host's metrics and heartbeats, and pushes it all to the gateway in the Prometheus text format with timestamps. When a push fails, the batch waits in a queue on disk and goes first next time, so a probe that loses its path to the gateway fills the gap when the path comes back. The queue has a size limit; the oldest batches go first.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

Agent runs the cycle, and beside it the poll for requests to probe on demand (requests.go).

func New

func New(cfg Config) *Agent

New creates an agent with defaults for what is unset.

func (*Agent) Cycle

func (a *Agent) Cycle(ctx context.Context) error

Cycle fetches, probes, collects and pushes once.

func (*Agent) Run

func (a *Agent) Run(ctx context.Context)

Run runs a cycle every interval until ctx ends, starting at once, and polls for requests to probe on demand beside it; it returns once both have stopped.

func (*Agent) Status

func (a *Agent) Status() []probe.Sample

Status is the agent's own state for its local /metrics, a look by hand or an install check: when it last pushed, how many pushes failed since it started, and what waits in the queue.

type Config

type Config struct {
	Gateway  string // such as https://metrics.example.com
	Token    string
	StateDir string // cache and queue
	Interval time.Duration
	Parallel int   // probes at once
	MaxQueue int64 // bytes on disk
	Prober   *probe.Prober
	Host     *hostmetrics.Collector
	HTTP     *http.Client
	Log      *slog.Logger
	Now      func() time.Time
}

Config is the agent's setup.

Jump to

Keyboard shortcuts

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