Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2015 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintOutputConfig

func PrintOutputConfig(name string) error

PrintOutputConfig prints the config usage of a single output.

func PrintPluginConfig

func PrintPluginConfig(name string) error

PrintPluginConfig prints the config usage of a single plugin.

func PrintSampleConfig

func PrintSampleConfig(pluginFilters []string, outputFilters []string)

PrintSampleConfig prints the sample config

Types

type AgentConfig

type AgentConfig struct {
	// Interval at which to gather information
	Interval internal.Duration

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

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

	// FlushRetries is the number of times to retry each data flush
	FlushRetries int

	// FlushJitter tells
	FlushJitter internal.Duration

	// TODO(cam): Remove UTC and Precision parameters, they are no longer
	// valid for the agent config. Leaving them here for now for backwards-
	// compatability
	UTC       bool `toml:"utc"`
	Precision string

	// Option for running in debug mode
	Debug    bool
	Hostname string
}

type Config

type Config struct {
	Tags          map[string]string
	PluginFilters []string
	OutputFilters []string

	Agent   *AgentConfig
	Plugins []*RunningPlugin
	Outputs []*RunningOutput
}

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

func NewConfig

func NewConfig() *Config

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) LoadDirectory

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

func (*Config) OutputNames

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

Outputs returns a list of strings of the configured plugins.

func (*Config) PluginNames

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

Plugins returns a list of strings of the configured plugins.

type PluginConfig

type PluginConfig struct {
	Name string

	Drop []string
	Pass []string

	TagDrop []TagFilter
	TagPass []TagFilter

	Interval time.Duration
}

PluginConfig containing a name, interval, and drop/pass prefix lists Also lists the tags to filter

func (*PluginConfig) ShouldPass

func (cp *PluginConfig) ShouldPass(measurement string) bool

ShouldPass returns true if the metric should pass, false if should drop based on the drop/pass plugin parameters

func (*PluginConfig) ShouldTagsPass

func (cp *PluginConfig) ShouldTagsPass(tags map[string]string) bool

ShouldTagsPass returns true if the metric should pass, false if should drop based on the tagdrop/tagpass plugin parameters

type RunningOutput

type RunningOutput struct {
	Name   string
	Output outputs.Output
}

type RunningPlugin

type RunningPlugin struct {
	Name   string
	Plugin plugins.Plugin
	Config *PluginConfig
}

type TagFilter

type TagFilter struct {
	Name   string
	Filter []string
}

TagFilter is the name of a tag, and the values on which to filter

Jump to

Keyboard shortcuts

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