config

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultInstanceID added in v0.0.13

func DefaultInstanceID() string

DefaultInstanceID returns the default instance id

func DefaultPluginsEnabled added in v0.0.16

func DefaultPluginsEnabled() bool

func IsAgentPlugin added in v0.0.16

func IsAgentPlugin(name string) bool

IsAgentPlugin checks if a plugin with a given name is an agent plugin

func IsDefaultInstanceID added in v0.0.13

func IsDefaultInstanceID(id string) bool

IsDefaultInstanceID checks if an id is the default

func IsDefaultPlugin added in v0.0.3

func IsDefaultPlugin(name string) bool

IsDefaultPlugin checks if a plugin with a given name is a default plugin

func PluginNameCounts

func PluginNameCounts(plugins []string) []string

PluginNameCounts returns a list of sorted plugin names and their count

func PrintInputConfig

func PrintInputConfig(name string) error

PrintInputConfig prints the config usage of a single input.

func PrintOutputConfig

func PrintOutputConfig(name string) error

PrintOutputConfig prints the config usage of a single output.

func PrintSampleConfig

func PrintSampleConfig(
	sectionFilters []string,
	inputFilters []string,
	outputFilters []string,
	aggregatorFilters []string,
	processorFilters []string,
)

PrintSampleConfig prints the sample config

Types

type AgentConfig

type AgentConfig struct {
	// Name of the file to be logged to when using the "file" logtarget.  If set to
	// the empty string then logs are written to stderr.
	Logfile string `toml:"logfile"`

	// It is !!important!! to set the hostname when using containers to prevent
	// a unique check being created every time the container starts.
	Hostname string

	// Log target controls the destination for logs and can be one of "file",
	// "stderr" or, on Windows, "eventlog".  When set to "file", the output file
	// is determined by the "logfile" setting.
	LogTarget string `toml:"logtarget"`

	Circonus CirconusConfig `toml:"circonus"`

	// FlushInterval is the Interval at which to flush data
	FlushInterval internal.Duration

	// FlushJitter Jitters the flush interval by a random amount.
	// This is primarily to avoid large write spikes for users running a large
	// number of circonus-unified-agent instances.
	// ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
	FlushJitter internal.Duration

	// CollectionJitter is used to jitter the collection by a random amount.
	// Each plugin will sleep for a random time within jitter before collecting.
	// This can be used to avoid many plugins querying things like sysfs at the
	// same time, which can have a measurable effect on the system.
	CollectionJitter internal.Duration

	// MetricBufferLimit is the max number of metrics that each output plugin
	// will cache. The buffer is cleared when a successful write occurs. When
	// full, the oldest metrics will be overwritten. This number should be a
	// multiple of MetricBatchSize. Due to current implementation, this could
	// not be less than 2 times MetricBatchSize.
	MetricBufferLimit int

	// Maximum number of rotated archives to keep, any older logs are deleted.
	// If set to -1, no archives are removed.
	LogfileRotationMaxArchives int `toml:"logfile_rotation_max_archives"`

	// The logfile will be rotated when it becomes larger than the specified
	// size.  When set to 0 no size based rotation is performed.
	LogfileRotationMaxSize internal.Size `toml:"logfile_rotation_max_size"`

	// By default or when set to "0s", precision will be set to the same
	// timestamp order as the collection interval, with the maximum being 1s.
	//   ie, when interval = "10s", precision will be "1s"
	//       when interval = "250ms", precision will be "1ms"
	// Precision will NOT be used for service inputs. It is up to each individual
	// service input to set the timestamp at the appropriate precision.
	Precision internal.Duration

	// The file will be rotated after the time interval specified.  When set
	// to 0 no time based rotation is performed.
	LogfileRotationInterval internal.Duration `toml:"logfile_rotation_interval"`

	// MetricBatchSize is the maximum number of metrics that is wrote to an
	// output plugin in one call.
	MetricBatchSize int

	// Interval at which to gather information
	Interval internal.Duration

	// Quiet is the option for running in quiet mode
	Quiet bool `toml:"quiet"`

	// RoundInterval rounds collection interval to 'interval'.
	//     ie, if Interval=10s then always collect on :00, :10, :20, etc.
	RoundInterval bool

	// DEPRECATED - hostname will no longer be added as a tag to every metric
	OmitHostname bool

	// Debug is the option for running in debug mode
	Debug bool `toml:"debug"`
}

AgentConfig defines configuration that will be used by the agent

type CirconusConfig added in v0.0.22

type CirconusConfig struct {
	DebugChecks     map[string]string `toml:"debug_checks"`
	TraceMetrics    string            `toml:"trace_metrics"`
	APIURL          string            `toml:"api_url"`
	APIToken        string            `toml:"api_token"`
	APIApp          string            `toml:"api_app"`
	APITLSCA        string            `toml:"api_tls_ca"`
	CacheDir        string            `toml:"cache_dir"`
	Broker          string            `toml:"broker"`
	CheckTarget     string            `toml:"check_target"`
	CheckSearchTags []string          `toml:"check_search_tags"`
	CheckTags       []string          `toml:"check_tags"`
	DebugAPI        bool              `toml:"debug_api"`
	CacheNoVerify   bool              `toml:"cache_no_verify"`
	CacheConfigs    bool              `toml:"cache_configs"`
}

CirconusConfig configures circonus check management Broker - optional: broker ID - numeric portion of _cid from broker api object (default is selected: enterprise or public httptrap broker) APIURL - optional: api url (default: https://api.circonus.com/v2) APIToken - REQUIRED: api token APIApp - optional: api app (default: circonus-unified-agent) APITLSCA - optional: api ca cert file CacheConfigs - optional: cache check bundle configurations - efficient for large number of inputs CacheDir - optional: where to cache the check bundle configurations - must be read/write for user running cua CacheNoVerify - optional: don't verify checks loaded from cache, just use them DebugAPI - optional: debug circonus api calls TraceMetrics - optional: output json sent to broker (path to write files to or `-` for logger) DebugChecks - optional: use when instructed by circonus support CheckSearchTags - optional: set of tags to use when searching for checks (default: service:circonus-unified-agentd) CheckTags - optional: set of tags to apply when creating a check CheckTarget - optional: set the check_target statically (instead of using hostname)

type Config

type Config struct {
	UnusedFields map[string]bool

	Tags          map[string]string
	InputFilters  []string
	OutputFilters []string

	Agent       *AgentConfig
	Inputs      []*models.RunningInput
	Outputs     []*models.RunningOutput
	Aggregators []*models.RunningAggregator
	// Processors have a slice wrapper type because they need to be sorted
	Processors    models.RunningProcessors
	AggProcessors models.RunningProcessors
	// contains filtered or unexported fields
}

Config specifies the URL/user/password for the database that circonus-unified-agent will be logging to, as well as all the plugins that the user has specified

func NewConfig

func NewConfig() *Config

NewConfig creates a new struct to hold the agent config. For historical reasons, It holds the actual instances of the running plugins once the configuration is parsed.

func (*Config) AggregatorNames

func (c *Config) AggregatorNames() []string

AggregatorNames returns a list of strings of the configured aggregators.

func (*Config) GetGlobalCirconusConfig added in v0.0.22

func (c *Config) GetGlobalCirconusConfig() *CirconusConfig

func (*Config) InputNames

func (c *Config) InputNames() []string

InputNames returns a list of strings of the configured inputs.

func (*Config) ListTags

func (c *Config) ListTags() string

ListTags returns a string of tags specified in the config, line-protocol style

func (*Config) LoadConfig

func (c *Config) LoadConfig(path string) error

LoadConfig loads the given config file and applies it to c

func (*Config) LoadConfigData

func (c *Config) LoadConfigData(data []byte) error

LoadConfigData loads TOML-formatted config data

func (*Config) LoadDefaultPlugins added in v0.0.21

func (c *Config) LoadDefaultPlugins() error

LoadDefaultPlugins adds default (for os) and agent plugins to inputs

func (*Config) LoadDirectory

func (c *Config) LoadDirectory(path string) error

LoadDirectory loads all toml config files found in the specified path, recursively.

func (*Config) OutputNames

func (c *Config) OutputNames() []string

OutputNames returns a list of strings of the configured outputs.

func (*Config) ProcessorNames

func (c *Config) ProcessorNames() []string

ProcessorNames returns a list of strings of the configured processors.

type Duration

type Duration time.Duration

Duration is a time.Duration

func (*Duration) UnmarshalTOML

func (d *Duration) UnmarshalTOML(b []byte) error

UnmarshalTOML parses the duration from the TOML config file

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type Size

type Size int64

Size is an int64

func (*Size) UnmarshalTOML

func (s *Size) UnmarshalTOML(b []byte) error

func (*Size) UnmarshalText

func (s *Size) UnmarshalText(text []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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