add backwards-compatability for 'plugins', remove [inputs] and [outputs] headers

This commit is contained in:
Cameron Sparr 2016-01-08 12:49:50 -07:00
parent 7499c1f969
commit 6496d185ab
5 changed files with 9 additions and 22 deletions

View File

@ -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/` `inputs/` and `outputs/` directories have been placed in the root-level `plugins/`
directory. directory.
- **breaking change** the `io` plugin has been renamed `diskio` - **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 - **breaking change** `jolokia` plugin: must use global tag/drop/pass parameters
for configuration. for configuration.
- **breaking change** `twemproxy` plugin: `prefix` option removed. - **breaking change** `twemproxy` plugin: `prefix` option removed.

View File

@ -24,27 +24,27 @@ InfluxDB.
## Input Configuration ## 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. * **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_prefix**: Specifies a prefix to attach to the measurement name.
* **name_suffix**: Specifies a suffix 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 * **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. you can configure that here.
### Input Filters ### 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 * **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. and if it matches, the field is emitted.
* **drop**: The inverse of pass, if a field name matches, it is not 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 * **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. 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 * **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. emitted. This is tested on measurements that have passed the tagpass test.
@ -64,14 +64,12 @@ fields which begin with `time_`.
interval = "10s" interval = "10s"
# OUTPUTS # OUTPUTS
[outputs]
[[outputs.influxdb]] [[outputs.influxdb]]
url = "http://192.168.59.103:8086" # required. url = "http://192.168.59.103:8086" # required.
database = "telegraf" # required. database = "telegraf" # required.
precision = "s" precision = "s"
# INPUTS # INPUTS
[inputs]
[[inputs.cpu]] [[inputs.cpu]]
percpu = true percpu = true
totalcpu = false totalcpu = false
@ -82,7 +80,6 @@ fields which begin with `time_`.
### Input Config: tagpass and tagdrop ### Input Config: tagpass and tagdrop
```toml ```toml
[inputs]
[[inputs.cpu]] [[inputs.cpu]]
percpu = true percpu = true
totalcpu = false totalcpu = false

View File

@ -49,8 +49,6 @@
# OUTPUTS # # OUTPUTS #
############################################################################### ###############################################################################
[outputs]
# Configuration for influxdb server to send metrics to # Configuration for influxdb server to send metrics to
[[outputs.influxdb]] [[outputs.influxdb]]
# The full HTTP or UDP endpoint URL for your InfluxDB instance. # The full HTTP or UDP endpoint URL for your InfluxDB instance.
@ -79,8 +77,6 @@
# INPUTS # # INPUTS #
############################################################################### ###############################################################################
[inputs]
# Read metrics about cpu usage # Read metrics about cpu usage
[[inputs.cpu]] [[inputs.cpu]]
# Whether to report per-cpu stats or not # Whether to report per-cpu stats or not

View File

@ -287,7 +287,6 @@ var header = `# Telegraf configuration
# OUTPUTS # # OUTPUTS #
############################################################################### ###############################################################################
[outputs]
` `
var pluginHeader = ` var pluginHeader = `
@ -296,7 +295,6 @@ var pluginHeader = `
# INPUTS # # INPUTS #
############################################################################### ###############################################################################
[inputs]
` `
var serviceInputHeader = ` var serviceInputHeader = `
@ -470,7 +468,7 @@ func (c *Config) LoadConfig(path string) error {
pluginName) pluginName)
} }
} }
case "inputs": case "inputs", "plugins":
for pluginName, pluginVal := range subTable.Fields { for pluginName, pluginVal := range subTable.Fields {
switch pluginSubTable := pluginVal.(type) { switch pluginSubTable := pluginVal.(type) {
case *ast.Table: case *ast.Table:

View File

@ -39,8 +39,6 @@
# OUTPUTS # # OUTPUTS #
############################################################################### ###############################################################################
[outputs]
# Configuration for influxdb server to send metrics to # Configuration for influxdb server to send metrics to
[[outputs.influxdb]] [[outputs.influxdb]]
# The full HTTP endpoint URL for your InfluxDB instance # The full HTTP endpoint URL for your InfluxDB instance
@ -70,8 +68,6 @@
# PLUGINS # # PLUGINS #
############################################################################### ###############################################################################
[inputs]
# Read Apache status information (mod_status) # Read Apache status information (mod_status)
[[inputs.apache]] [[inputs.apache]]
# An array of Apache status URI to gather stats. # An array of Apache status URI to gather stats.