From 6496d185ab7f6fd564893825717c9c26435ea9a7 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Fri, 8 Jan 2016 12:49:50 -0700 Subject: [PATCH] add backwards-compatability for 'plugins', remove [inputs] and [outputs] headers --- CHANGELOG.md | 2 +- CONFIGURATION.md | 17 +++++++---------- etc/telegraf.conf | 4 ---- internal/config/config.go | 4 +--- internal/config/testdata/telegraf-agent.toml | 4 ---- 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 310051ea1..dbb364bac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ be "aggregator plugins" and "filter plugins" in the future. Additionally, `inputs/` and `outputs/` directories have been placed in the root-level `plugins/` directory. - **breaking change** the `io` plugin has been renamed `diskio` -- **breaking change** Plugin measurements aggregated into a single measurement. +- **breaking change** plugin measurements aggregated into a single measurement. - **breaking change** `jolokia` plugin: must use global tag/drop/pass parameters for configuration. - **breaking change** `twemproxy` plugin: `prefix` option removed. diff --git a/CONFIGURATION.md b/CONFIGURATION.md index ef91f0a06..ee79da98a 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -24,27 +24,27 @@ InfluxDB. ## Input Configuration -There are some configuration options that are configurable per plugin: +There are some configuration options that are configurable per input: * **name_override**: Override the base name of the measurement. -(Default is the name of the plugin). +(Default is the name of the input). * **name_prefix**: Specifies a prefix to attach to the measurement name. * **name_suffix**: Specifies a suffix to attach to the measurement name. -* **tags**: A map of tags to apply to a specific plugin's measurements. +* **tags**: A map of tags to apply to a specific input's measurements. * **interval**: How often to gather this metric. Normal plugins use a single -global interval, but if one particular plugin should be run less or more often, +global interval, but if one particular input should be run less or more often, you can configure that here. ### Input Filters -There are also filters that can be configured per plugin: +There are also filters that can be configured per input: * **pass**: An array of strings that is used to filter metrics generated by the -current plugin. Each string in the array is tested as a glob match against field names +current input. Each string in the array is tested as a glob match against field names and if it matches, the field is emitted. * **drop**: The inverse of pass, if a field name matches, it is not emitted. * **tagpass**: tag names and arrays of strings that are used to filter -measurements by the current plugin. Each string in the array is tested as a glob +measurements by the current input. Each string in the array is tested as a glob match against the tag name, and if it matches the measurement is emitted. * **tagdrop**: The inverse of tagpass. If a tag matches, the measurement is not emitted. This is tested on measurements that have passed the tagpass test. @@ -64,14 +64,12 @@ fields which begin with `time_`. interval = "10s" # OUTPUTS -[outputs] [[outputs.influxdb]] url = "http://192.168.59.103:8086" # required. database = "telegraf" # required. precision = "s" # INPUTS -[inputs] [[inputs.cpu]] percpu = true totalcpu = false @@ -82,7 +80,6 @@ fields which begin with `time_`. ### Input Config: tagpass and tagdrop ```toml -[inputs] [[inputs.cpu]] percpu = true totalcpu = false diff --git a/etc/telegraf.conf b/etc/telegraf.conf index eb50005a5..9df2e93d5 100644 --- a/etc/telegraf.conf +++ b/etc/telegraf.conf @@ -49,8 +49,6 @@ # OUTPUTS # ############################################################################### -[outputs] - # Configuration for influxdb server to send metrics to [[outputs.influxdb]] # The full HTTP or UDP endpoint URL for your InfluxDB instance. @@ -79,8 +77,6 @@ # INPUTS # ############################################################################### -[inputs] - # Read metrics about cpu usage [[inputs.cpu]] # Whether to report per-cpu stats or not diff --git a/internal/config/config.go b/internal/config/config.go index e96856015..6c3d17750 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -287,7 +287,6 @@ var header = `# Telegraf configuration # OUTPUTS # ############################################################################### -[outputs] ` var pluginHeader = ` @@ -296,7 +295,6 @@ var pluginHeader = ` # INPUTS # ############################################################################### -[inputs] ` var serviceInputHeader = ` @@ -470,7 +468,7 @@ func (c *Config) LoadConfig(path string) error { pluginName) } } - case "inputs": + case "inputs", "plugins": for pluginName, pluginVal := range subTable.Fields { switch pluginSubTable := pluginVal.(type) { case *ast.Table: diff --git a/internal/config/testdata/telegraf-agent.toml b/internal/config/testdata/telegraf-agent.toml index 3c279db34..5ede47016 100644 --- a/internal/config/testdata/telegraf-agent.toml +++ b/internal/config/testdata/telegraf-agent.toml @@ -39,8 +39,6 @@ # OUTPUTS # ############################################################################### -[outputs] - # Configuration for influxdb server to send metrics to [[outputs.influxdb]] # The full HTTP endpoint URL for your InfluxDB instance @@ -70,8 +68,6 @@ # PLUGINS # ############################################################################### -[inputs] - # Read Apache status information (mod_status) [[inputs.apache]] # An array of Apache status URI to gather stats.