Documentation ¶
Index ¶
- type Config
- type Parser
- func NewGraphiteParser(separator string, templates []string, defaultTags map[string]string) (Parser, error)
- func NewInfluxParser() (Parser, error)
- func NewJSONParser(metricName string, tagKeys []string, defaultTags map[string]string) (Parser, error)
- func NewJSONParserWithExtractKeys(metricName string, tagKeys []string, defaultTags map[string]string, ...) (Parser, error)
- func NewNagiosParser() (Parser, error)
- func NewParser(config *Config) (Parser, error)
- func NewValueParser(metricName string, dataType string, defaultTags map[string]string) (Parser, error)
- type ParserInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Dataformat can be one of: json, influx, graphite, value, nagios DataFormat string // Separator only applied to Graphite data. Separator string // Templates only apply to Graphite data. Templates []string // TagKeys only apply to JSON data TagKeys []string // MetricName applies to JSON & value. This will be the name of the measurement. MetricName string // DataType only applies to value, this will be the type to parse value to DataType string // DefaultTags are the default tags that will be added to all parsed metrics. DefaultTags map[string]string }
Config is a struct that covers the data types needed for all parser types, and can be used to instantiate _any_ of the parsers.
type Parser ¶
type Parser interface { // Parse takes a byte buffer separated by newlines // ie, `cpu.usage.idle 90\ncpu.usage.busy 10` // and parses it into telegraf metrics Parse(buf []byte) ([]telegraf.Metric, error) // ParseLine takes a single string metric // ie, "cpu.usage.idle 90" // and parses it into a telegraf metric. ParseLine(line string) (telegraf.Metric, error) // SetDefaultTags tells the parser to add all of the given tags // to each parsed metric. // NOTE: do _not_ modify the map after you've passed it here!! SetDefaultTags(tags map[string]string) }
Parser is an interface defining functions that a parser plugin must satisfy.
func NewGraphiteParser ¶
func NewInfluxParser ¶
func NewJSONParser ¶
func NewNagiosParser ¶
type ParserInput ¶
type ParserInput interface { // SetParser sets the parser function for the interface SetParser(parser Parser) }
ParserInput is an interface for input plugins that are able to parse arbitrary data formats.
Click to show internal directories.
Click to hide internal directories.