agent

package
v0.0.0-...-19c0d85 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package agent implements the client side of the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectOS

func DetectOS() (string, string, error)

DetectOS detects the operating system name. Works by calling uname, so this does not work on Windows.

Types

type Agent

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

Agent wraps the state of the client.

func Create

func Create(srv string) (*Agent, error)

Create creates a new Agent.

func (*Agent) Run

func (ag *Agent) Run()

Run executes the Agent's main loop.

type LoadProbe

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

LoadProbe gathers the system load average.

func CreateLoadProbe

func CreateLoadProbe(q chan<- model.Record) (*LoadProbe, error)

CreateLoadProbe creates a Probe that collects the system load average periodically.

func (*LoadProbe) Collect

func (p *LoadProbe) Collect() (*model.Record, error)

Collect gathers the system load averages and wraps them in a Record.

func (*LoadProbe) Run

func (p *LoadProbe) Run()

Run executes the Probe's collect loop, this is usually executed in a separate goroutine.

func (*LoadProbe) Running

func (p *LoadProbe) Running() bool

Running returns true if the Probe is active.

func (*LoadProbe) Stop

func (p *LoadProbe) Stop()

Stop tells the Probe to stop.

type Probe

type Probe interface {
	Collect() (*model.Record, error)
	Run()
	Running() bool
	Stop()
}

Probe defines an interface for components that gather data from the node and return them as Records that can be sent back to the Server.

type SensorsProbe

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

SensorsProbe gathers data from sensors, most importantly temperature.

func CreateSensorsProbe

func CreateSensorsProbe(recQ chan<- model.Record) (*SensorsProbe, error)

CreateSensorsProbe creates a Probe that queries the sensors attached to the system periodically.

func (*SensorsProbe) Collect

func (p *SensorsProbe) Collect() (*model.Record, error)

Collect data from the sensors

func (*SensorsProbe) Run

func (p *SensorsProbe) Run()

Run executes the Probe's collect loop, this is usually executed in a separate goroutine.

func (*SensorsProbe) Running

func (p *SensorsProbe) Running() bool

Running returns the Probe's active flag

func (*SensorsProbe) Stop

func (p *SensorsProbe) Stop()

Stop clears the Probe's active flag

Directories

Path Synopsis
Package platform provides symbolic constants for identifiying the operating system / distro and the corresponding package manager.
Package platform provides symbolic constants for identifiying the operating system / distro and the corresponding package manager.

Jump to

Keyboard shortcuts

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