agent

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MemberAlive   MemberStatus = "alive"
	MemberLeaving              = "leaving"
	MemberLeft                 = "left"
	MemberFailed               = "failed"
)
View Source
const RPCPort = 7575 // FIXME: use serf to discover agents

Default RPC port.

Variables

This section is empty.

Functions

func NewClient

func NewClient(addr string) (*client, error)

NewClient creates a new instance of an agent RPC client to the given address.

Types

type Agent

type Agent interface {
	// Start starts agent's background jobs.
	Start() error
	// Close stops background activity and releases resources.
	Close() error
	// Join makes an attempt to join a cluster specified by the list of peers.
	Join(peers []string) error
	// LocalStatus reports the health status of the local agent node.
	LocalStatus() *pb.NodeStatus
	// IsMember returns whether this agent is already a member of serf cluster
	IsMember() bool
	health.CheckerRepository
}

Agent is the interface to interact with the monitoring agent.

func New

func New(config *Config) (Agent, error)

New creates an instance of an agent based on configuration options given in config.

type Client

type Client interface {
	// Status reports the health status of a serf cluster.
	Status(context.Context) (*pb.SystemStatus, error)
	// LocalStatus reports the health status of the local serf cluster node.
	LocalStatus(context.Context) (*pb.NodeStatus, error)
}

Client is an interface to communicate with the serf cluster via agent RPC.

type Config

type Config struct {
	// Name of the agent unique within the cluster.
	// Names are used as a unique id within a serf cluster, so
	// it is important to avoid clashes.
	//
	// Name must match the name of the local serf agent so that the agent
	// can match itself to a serf member.
	Name string

	// RPCAddrs is a list of addresses agent binds to for RPC traffic.
	//
	// Usually, at least two address are used for operation.
	// Localhost is a convenience for local communication.  Cluster-visible
	// IP is required for proper inter-communication between agents.
	RPCAddrs []string

	// RPC address of local serf node.
	SerfRPCAddr string

	// Address to listen on for web interface and telemetry for Prometheus metrics.
	MetricsAddr string

	// Peers lists the nodes that are part of the initial serf cluster configuration.
	// This is not a final cluster configuration and new nodes or node updates
	// are still possible.
	Peers []string

	// Set of tags for the agent.
	// Tags is a trivial means for adding extra semantic information to an agent.
	Tags map[string]string

	// Cache is a short-lived storage used by the agent to persist latest health stats.
	cache.Cache
}

type MemberStatus

type MemberStatus string

MemberStatus describes the state of a serf node.

type RPCServer

type RPCServer interface {
	Status(context.Context, *pb.StatusRequest) (*pb.StatusResponse, error)
	LocalStatus(context.Context, *pb.LocalStatusRequest) (*pb.LocalStatusResponse, error)
	Stop()
}

RPCServer is the interface that defines the interaction with an agent via RPC.

type Role

type Role string

Role describes the agent's server role.

const (
	RoleMaster Role = "master"
	RoleNode        = "node"
)

Directories

Path Synopsis
influxdb
package influxdb implements a backend to InfluxDB (https://influxdata.com)
package influxdb implements a backend to InfluxDB (https://influxdata.com)
package health defines health checking primitives.
package health defines health checking primitives.
proto
agentpb
Package agentpb is a generated protocol buffer package.
Package agentpb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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