monitor

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PingTypeUDP    = "udp"
	PingTypeSocket = "socket"
)
View Source
const (
	NodeAliveStatus    = "Node alive or reachable"
	NodeCriticalStatus = "Node not live or unreachable"
)
View Source
const LeaderKey = "leader"

Variables

View Source
var (
	// The maximum time to wait for a ping to complete.
	MaxRTT = 5 * time.Second
)

Functions

func MergeConfig

func MergeConfig(dst *Config, src *HumanConfig)

func MergeConfigPaths

func MergeConfigPaths(dst *Config, paths []string) error

MergeConfigPaths takes a list of config files or config directories and merges them on top of the given config.

func ValidateConfig

func ValidateConfig(conf *Config) error

ValidateConfig verifies that the given Config object is valid.

Types

type Agent

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

func NewAgent

func NewAgent(config *Config, logger *log.Logger) (*Agent, error)

func (*Agent) Run

func (a *Agent) Run() error

func (*Agent) ServiceID

func (a *Agent) ServiceID() string

func (*Agent) Shutdown

func (a *Agent) Shutdown()

type CheckRunner

type CheckRunner struct {
	sync.RWMutex

	CheckUpdateInterval time.Duration
	// contains filtered or unexported fields
}

func NewCheckRunner

func NewCheckRunner(logger *log.Logger, client *api.Client, updateInterval time.Duration) *CheckRunner

func (*CheckRunner) Stop

func (c *CheckRunner) Stop()

func (*CheckRunner) UpdateCheck

func (c *CheckRunner) UpdateCheck(checkID types.CheckID, status, output string)

UpdateCheck handles the output of an HTTP/TCP check and decides whether or not to push an update to the catalog.

func (*CheckRunner) UpdateChecks

func (c *CheckRunner) UpdateChecks(checks api.HealthChecks)

UpdateChecks takes a list of checks from the catalog and updates our list of running checks to match.

type Config

type Config struct {
	LogLevel       string
	EnableSyslog   bool
	SyslogFacility string

	Service string
	Tag     string
	KVPath  string

	NodeMeta                 map[string]string
	Interval                 time.Duration
	DeregisterAfter          time.Duration
	CheckUpdateInterval      time.Duration
	CoordinateUpdateInterval time.Duration
	NodeReconnectTimeout     time.Duration

	HTTPAddr      string
	Token         string
	Datacenter    string
	CAFile        string
	CAPath        string
	CertFile      string
	KeyFile       string
	TLSServerName string

	PingType string
	// contains filtered or unexported fields
}

func BuildConfig

func BuildConfig(configFiles []string) (*Config, error)

BuildConfig builds a new Config object from the default configuration and the list of config files given and returns it after validation.

func DefaultConfig

func DefaultConfig() *Config

func (*Config) ClientConfig

func (c *Config) ClientConfig() *api.Config

type HumanConfig

type HumanConfig struct {
	LogLevel       flags.StringValue `mapstructure:"log_level"`
	EnableSyslog   flags.BoolValue   `mapstructure:"enable_syslog"`
	SyslogFacility flags.StringValue `mapstructure:"syslog_facility"`

	Service  flags.StringValue   `mapstructure:"consul_service"`
	Tag      flags.StringValue   `mapstructure:"consul_service_tag"`
	KVPath   flags.StringValue   `mapstructure:"consul_kv_path"`
	NodeMeta []map[string]string `mapstructure:"external_node_meta"`

	NodeReconnectTimeout flags.DurationValue `mapstructure:"node_reconnect_timeout"`
	NodeProbeInterval    flags.DurationValue `mapstructure:"node_probe_interval"`

	HTTPAddr      flags.StringValue `mapstructure:"http_addr"`
	Token         flags.StringValue `mapstructure:"token"`
	Datacenter    flags.StringValue `mapstructure:"datacenter"`
	CAFile        flags.StringValue `mapstructure:"ca_file"`
	CAPath        flags.StringValue `mapstructure:"ca_path"`
	CertFile      flags.StringValue `mapstructure:"cert_file"`
	KeyFile       flags.StringValue `mapstructure:"key_file"`
	TLSServerName flags.StringValue `mapstructure:"tls_server_name"`

	PingType flags.StringValue `mapstructure:"ping_type"`
}

func DecodeConfig

func DecodeConfig(r io.Reader) (*HumanConfig, error)

type NodeWatchList

type NodeWatchList struct {
	Nodes  []string
	Probes []string
}

Jump to

Keyboard shortcuts

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