Documentation ¶
Index ¶
- func LoadConfigFile(config string) ([]byte, error)
- func PluginNameCounts(plugins []string) []string
- func ReleaseSecret(secret []byte)
- func WalkDirectory(path string) ([]string, error)
- type AgentConfig
- type Config
- func (c *Config) AggregatorNames() []string
- func (c *Config) CollectDeprecationInfos(inFilter, outFilter, aggFilter, procFilter []string) map[string][]PluginDeprecationInfo
- func (c *Config) InputNames() []string
- func (c *Config) LinkSecrets() error
- func (c *Config) ListTags() string
- func (c *Config) LoadAll(configFiles ...string) error
- func (c *Config) LoadConfig(path string) error
- func (c *Config) LoadConfigData(data []byte) error
- func (c *Config) OutputNames() []string
- func (c *Config) PrintDeprecationList(plugins []PluginDeprecationInfo)
- func (c *Config) ProcessorNames() []string
- func (c *Config) SecretstoreNames() []string
- type DeprecationInfo
- type Duration
- type OrderedPlugin
- type OrderedPlugins
- type PluginDeprecationInfo
- type Secret
- func (s *Secret) Destroy()
- func (s *Secret) Empty() bool
- func (s *Secret) EqualTo(ref []byte) (bool, error)
- func (s *Secret) Get() ([]byte, error)
- func (s *Secret) GetUnlinked() []string
- func (s *Secret) Link(resolvers map[string]telegraf.ResolveFunc) error
- func (s *Secret) Set(value []byte) error
- func (s *Secret) UnmarshalText(b []byte) error
- type Size
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadConfigFile ¶ added in v1.24.0
func PluginNameCounts ¶ added in v1.16.0
PluginNameCounts returns a list of sorted plugin names and their count
func ReleaseSecret ¶ added in v1.25.0
func ReleaseSecret(secret []byte)
func WalkDirectory ¶ added in v1.25.0
WalkDirectory collects all toml files that need to be loaded
Types ¶
type AgentConfig ¶
type AgentConfig struct { // Interval at which to gather information Interval Duration // RoundInterval rounds collection interval to 'interval'. // ie, if Interval=10s then always collect on :00, :10, :20, etc. RoundInterval bool // Collected metrics are rounded to the precision specified. Precision is // specified as an interval with an integer + unit (e.g. 0s, 10ms, 2us, 4s). // Valid time units are "ns", "us" (or "µs"), "ms", "s". // // 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 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 Duration // CollectionOffset is used to shift the collection by the given amount. // This can be used to avoid many plugins querying constraint devices // at the same time by manually scheduling them in time. CollectionOffset Duration // FlushInterval is the Interval at which to flush data FlushInterval 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 telegraf instances. // ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s FlushJitter Duration // MetricBatchSize is the maximum number of metrics that is written to an // output plugin in one call. MetricBatchSize int // 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 // FlushBufferWhenFull tells Telegraf to flush the metric buffer whenever // it fills up, regardless of FlushInterval. Setting this option to true // does _not_ deactivate FlushInterval. FlushBufferWhenFull bool `toml:"flush_buffer_when_full" deprecated:"0.13.0;2.0.0;option is ignored"` // TODO(cam): Remove UTC and parameter, they are no longer // valid for the agent config. Leaving them here for now for backwards- // compatibility UTC bool `toml:"utc" deprecated:"1.0.0;option is ignored"` // Debug is the option for running in debug mode Debug bool `toml:"debug"` // Quiet is the option for running in quiet mode Quiet bool `toml:"quiet"` // 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"` // 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"` // The file will be rotated after the time interval specified. When set // to 0 no time based rotation is performed. LogfileRotationInterval Duration `toml:"logfile_rotation_interval"` // The logfile will be rotated when it becomes larger than the specified // size. When set to 0 no size based rotation is performed. LogfileRotationMaxSize Size `toml:"logfile_rotation_max_size"` // 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"` // Pick a timezone to use when logging or type 'local' for local time. LogWithTimezone string `toml:"log_with_timezone"` Hostname string OmitHostname bool // Method for translating SNMP objects. 'netsnmp' to call external programs, // 'gosmi' to use the built-in library. SnmpTranslator string `toml:"snmp_translator"` // Name of the file to load the state of plugins from and store the state to. // If uncommented and not empty, this file will be used to save the state of // stateful plugins on termination of Telegraf. If the file exists on start, // the state in the file will be restored for the plugins. Statefile string `toml:"statefile"` }
AgentConfig defines configuration that will be used by the Telegraf agent
type Config ¶
type Config struct { UnusedFields map[string]bool Tags map[string]string InputFilters []string OutputFilters []string SecretStoreFilters []string SecretStores map[string]telegraf.SecretStore 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 Deprecations map[string][]int64 Persister *persister.Persister NumberSecrets uint64 // contains filtered or unexported fields }
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
NewConfig creates a new struct to hold the Telegraf config. For historical reasons, It holds the actual instances of the running plugins once the configuration is parsed.
func (*Config) AggregatorNames ¶
AggregatorNames returns a list of strings of the configured aggregators.
func (*Config) CollectDeprecationInfos ¶ added in v1.21.0
func (c *Config) CollectDeprecationInfos(inFilter, outFilter, aggFilter, procFilter []string) map[string][]PluginDeprecationInfo
func (*Config) InputNames ¶
InputNames returns a list of strings of the configured inputs.
func (*Config) LinkSecrets ¶ added in v1.25.0
func (*Config) ListTags ¶
ListTags returns a string of tags specified in the config, line-protocol style
func (*Config) LoadConfig ¶
LoadConfig loads the given config files and applies it to c
func (*Config) LoadConfigData ¶
LoadConfigData loads TOML-formatted config data
func (*Config) OutputNames ¶
OutputNames returns a list of strings of the configured outputs.
func (*Config) PrintDeprecationList ¶ added in v1.21.0
func (c *Config) PrintDeprecationList(plugins []PluginDeprecationInfo)
func (*Config) ProcessorNames ¶
ProcessorNames returns a list of strings of the configured processors.
func (*Config) SecretstoreNames ¶ added in v1.25.0
SecretstoreNames returns a list of strings of the configured secret-stores.
type DeprecationInfo ¶ added in v1.24.0
type DeprecationInfo struct { // Name of the plugin or plugin option Name string // LogLevel is the level of deprecation which currently corresponds to a log-level LogLevel telegraf.Escalation // contains filtered or unexported fields }
DeprecationInfo contains all important information to describe a deprecated entity
type Duration ¶
Duration is a time.Duration
func (*Duration) UnmarshalText ¶ added in v1.15.3
UnmarshalTOML parses the duration from the TOML config file
type OrderedPlugin ¶ added in v1.25.0
type OrderedPlugin struct { Line int // contains filtered or unexported fields }
Ordered plugins used to keep the order in which they appear in a file
type OrderedPlugins ¶ added in v1.25.0
type OrderedPlugins []*OrderedPlugin
func (OrderedPlugins) Len ¶ added in v1.25.0
func (op OrderedPlugins) Len() int
func (OrderedPlugins) Less ¶ added in v1.25.0
func (op OrderedPlugins) Less(i, j int) bool
func (OrderedPlugins) Swap ¶ added in v1.25.0
func (op OrderedPlugins) Swap(i, j int)
type PluginDeprecationInfo ¶ added in v1.24.0
type PluginDeprecationInfo struct { DeprecationInfo // Options deprecated for this plugin Options []DeprecationInfo }
PluginDeprecationInfo holds all information about a deprecated plugin or it's options
type Secret ¶ added in v1.25.0
type Secret struct {
// contains filtered or unexported fields
}
Secret safely stores sensitive data such as a password or token
var ( // Password specified via command-line Password Secret )
func (*Secret) EqualTo ¶ added in v1.26.0
EqualTo performs a constant-time comparison of the secret to the given reference
func (*Secret) GetUnlinked ¶ added in v1.25.0
GetUnlinked return the parts of the secret that is not yet linked to a resolver
func (*Secret) Link ¶ added in v1.25.0
func (s *Secret) Link(resolvers map[string]telegraf.ResolveFunc) error
Link used the given resolver map to link the secret parts to their secret-store resolvers.
func (*Secret) Set ¶ added in v1.26.1
Set overwrites the secret's value with a new one. Please note, the secret is not linked again, so only references to secret-stores can be used, e.g. by adding more clear-text or reordering secrets.
func (*Secret) UnmarshalText ¶ added in v1.25.1
UnmarshalText creates a secret from a toml value following the "string" rule.