agent

package
v0.0.0-...-ee3d319 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSender

func GetSender(ctx context.Context, prefix, taskId string) (send.Sender, error)

GetSender configures the agent's local logging to a file.

Types

type Agent

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

Agent manages the data necessary to run tasks on a host.

func New

func New(opts Options, comm client.Communicator) *Agent

New creates a new Agent with some Options and a client.Communicator. Call the Agent's Start method to begin listening for tasks to run.

func (*Agent) Start

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

Start starts the agent loop. The agent polls the API server for new tasks at interval agentSleepInterval and runs them.

type Options

type Options struct {
	HostID             string
	HostSecret         string
	StatusPort         int
	LogPrefix          string
	WorkingDirectory   string
	HeartbeatInterval  time.Duration
	AgentSleepInterval time.Duration
	Cleanup            bool
}

Options contains startup options for the Agent.

type StatsCollector

type StatsCollector struct {
	Cmds []string
	// indicates the sampling frequency
	Interval time.Duration
	// contains filtered or unexported fields
}

StatsCollector samples machine statistics and logs them back to the API server at regular intervals.

func NewSimpleStatsCollector

func NewSimpleStatsCollector(logger client.LoggerProducer, interval time.Duration, cmds ...string) *StatsCollector

NewSimpleStatsCollector creates a StatsCollector that runs the given commands at the given interval and sends the results to the given logger.

Jump to

Keyboard shortcuts

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