config

package
v0.1.9 Latest Latest
Warning

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

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

Documentation

Overview

Package config declares the data structures used for all execution entry points

Constants

Index

Constants

View Source
const (
	DefaultTimeoutRead       = 10 * time.Second
	DefaultTimeoutWrite      = 10 * time.Second
	DefaultTimeoutPrepareEnd = 60 * time.Second
	DefaultAgentId           = "-poller-"
)
View Source
const (
	DefaultConfigPathLinux = "/etc/rackspace-monitoring-agent.cfg"

	DefaultPort = "50041"

	EnvStaging    = "STAGING"
	EnvDevCA      = "DEV_CA"
	EnabledEnvOpt = "1"
)

Variables

View Source
var (
	ErrorNoZones = errors.New("No zones are defined")
	ErrorNoToken = errors.New("No token is defined")
)
View Source
var (
	DefaultProdSrvEndpoints = []string{
		"_monitoringagent._tcp.dfw1.prod.monitoring.api.rackspacecloud.com",
		"_monitoringagent._tcp.ord1.prod.monitoring.api.rackspacecloud.com",
		"_monitoringagent._tcp.lon3.prod.monitoring.api.rackspacecloud.com",
	}
	DefaultStagingSrvEndpoints = []string{
		"_monitoringagent._tcp.dfw1.stage.monitoring.api.rackspacecloud.com",
		"_monitoringagent._tcp.ord1.stage.monitoring.api.rackspacecloud.com",
		"_monitoringagent._tcp.lon3.stage.monitoring.api.rackspacecloud.com",
	}
	ValidSnetRegions = []string{
		"dfw",
		"ord",
		"lon",
		"syd",
		"hkg",
		"iad",
	}
	SnetMonitoringTemplateSrvQueries = []*template.Template{
		template.Must(template.New("0").Parse("_monitoringagent._tcp.snet-{{.SnetRegion}}-region0.prod.monitoring.api.rackspacecloud.com")),
		template.Must(template.New("1").Parse("_monitoringagent._tcp.snet-{{.SnetRegion}}-region1.prod.monitoring.api.rackspacecloud.com")),
		template.Must(template.New("2").Parse("_monitoringagent._tcp.snet-{{.SnetRegion}}-region2.prod.monitoring.api.rackspacecloud.com")),
	}
	SnetMonitoringTemplateSrvQueriesStaging = []*template.Template{
		template.Must(template.New("0").Parse("_monitoringagent._tcp.snet-{{.SnetRegion}}-region0.stage.monitoring.api.rackspacecloud.com")),
		template.Must(template.New("1").Parse("_monitoringagent._tcp.snet-{{.SnetRegion}}-region1.stage.monitoring.api.rackspacecloud.com")),
		template.Must(template.New("2").Parse("_monitoringagent._tcp.snet-{{.SnetRegion}}-region2.stage.monitoring.api.rackspacecloud.com")),
	}
)

Functions

func IsUsingStaging

func IsUsingStaging() bool

func LoadDevelopmentCAs

func LoadDevelopmentCAs(pemFilename string) *x509.CertPool

func LoadProductionCAs

func LoadProductionCAs() *x509.CertPool

func LoadRootCAs

func LoadRootCAs(insecure bool, useStaging bool) *x509.CertPool

func LoadStagingCAs

func LoadStagingCAs() *x509.CertPool

Types

type BadConfig

type BadConfig struct {
	Details string
}

func (BadConfig) Error

func (e BadConfig) Error() string

type Config

type Config struct {
	// Addresses
	UseSrv     bool
	UseStaging bool
	SrvQueries []string
	Addresses  []string

	// Agent Info
	AgentId        string
	AgentName      string
	Features       []map[string]string
	Guid           string
	BundleVersion  string
	ProcessVersion string
	Token          string
	SnetRegion     string

	// Zones
	ZoneIds []string

	// Timeouts
	TimeoutRead  time.Duration
	TimeoutWrite time.Duration
	// TimeoutPrepareEnd declares the max time to elapse between poller.prepare and poller.prepare.end, but
	// is reset upon receipt of each poller.prepare.block.
	TimeoutPrepareEnd time.Duration
}

func NewConfig

func NewConfig(guid string, useStaging bool) *Config

func (*Config) ComputeReadDeadline

func (cfg *Config) ComputeReadDeadline(offset time.Duration) time.Time

func (*Config) ComputeWriteDeadline

func (cfg *Config) ComputeWriteDeadline(offset time.Duration) time.Time

func (*Config) DefineConfigEntries

func (cfg *Config) DefineConfigEntries() []configEntry

func (*Config) LoadFromFile

func (cfg *Config) LoadFromFile(filepath string) error

LoadFromFile populates this Config with the values defined in that file and then calls PostProcess.

func (*Config) ParseFields

func (cfg *Config) ParseFields(configEntries []configEntry, fields []string) error

func (*Config) PostProcess

func (cfg *Config) PostProcess() error

func (*Config) SetPrivateZones

func (cfg *Config) SetPrivateZones(zones []string)

func (*Config) Validate

func (cfg *Config) Validate() error

type EndpointConfig

type EndpointConfig struct {
	CertFile string
	KeyFile  string

	// In the form of "IP:port" or just ":port" to bind to all interfaces
	BindAddr string

	// StatsDAddr specifies the UDP host:port of a StatsD backend
	StatsDAddr string

	// AgentsConfigDir references a directory that is structured as
	//   <ZONE>/
	//     <AGENT ID>/
	//       checks/
	//         *.json
	AgentsConfigDir string

	PrepareBlockSize int
}

func NewEndpointConfig

func NewEndpointConfig() *EndpointConfig

func (*EndpointConfig) LoadFromFile

func (cfg *EndpointConfig) LoadFromFile(filepath string) error

Jump to

Keyboard shortcuts

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