Indent the toml config for readability

This commit is contained in:
Cameron Sparr 2015-08-26 09:21:39 -06:00
parent a00510a73c
commit 434267898b
21 changed files with 143 additions and 135 deletions

View File

@ -6,6 +6,7 @@
- [#137](https://github.com/influxdb/telegraf/issues/137): Memcached: fix when a value contains a space - [#137](https://github.com/influxdb/telegraf/issues/137): Memcached: fix when a value contains a space
- [#138](https://github.com/influxdb/telegraf/issues/138): MySQL server address tag. - [#138](https://github.com/influxdb/telegraf/issues/138): MySQL server address tag.
- [#142](https://github.com/influxdb/telegraf/pull/142): Add Description and SampleConfig funcs to output interface - [#142](https://github.com/influxdb/telegraf/pull/142): Add Description and SampleConfig funcs to output interface
- Indent the toml config file for readability
### Bugfixes ### Bugfixes
- [#128](https://github.com/influxdb/telegraf/issues/128): system_load measurement missing. - [#128](https://github.com/influxdb/telegraf/issues/128): system_load measurement missing.

View File

@ -387,11 +387,11 @@ func PrintSampleConfig() {
creator := outputs.Outputs[oname] creator := outputs.Outputs[oname]
output := creator() output := creator()
fmt.Printf("\n# %s\n[outputs.%s]\n", output.Description(), oname) fmt.Printf("\n# %s\n[outputs.%s]", output.Description(), oname)
config := output.SampleConfig() config := output.SampleConfig()
if config == "" { if config == "" {
fmt.Printf(" # no configuration\n\n") fmt.Printf("\n # no configuration\n")
} else { } else {
fmt.Printf(config) fmt.Printf(config)
} }
@ -411,17 +411,13 @@ func PrintSampleConfig() {
creator := plugins.Plugins[pname] creator := plugins.Plugins[pname]
plugin := creator() plugin := creator()
fmt.Printf("# %s\n[%s]\n", plugin.Description(), pname) fmt.Printf("\n# %s\n[%s]", plugin.Description(), pname)
config := plugin.SampleConfig() config := plugin.SampleConfig()
if config == "" { if config == "" {
fmt.Printf(" # no configuration\n\n") fmt.Printf("\n # no configuration\n")
} else { } else {
lines := strings.Split(config, "\n") fmt.Printf(config)
for _, line := range lines {
fmt.Printf("%s\n", line)
}
fmt.Printf("\n")
} }
} }
} }

View File

@ -26,7 +26,8 @@ var sampleConfig = `
# 10.0.0.1:10000, etc. # 10.0.0.1:10000, etc.
# #
# If no servers are specified, then localhost is used as the host. # If no servers are specified, then localhost is used as the host.
servers = ["localhost"]` servers = ["localhost"]
`
func (r *Disque) SampleConfig() string { func (r *Disque) SampleConfig() string {
return sampleConfig return sampleConfig

View File

@ -30,7 +30,8 @@ consumerGroupName = "telegraf_metrics_consumers"
zookeeperPeers = ["localhost:2181"] zookeeperPeers = ["localhost:2181"]
# Batch size of points sent to InfluxDB # Batch size of points sent to InfluxDB
batchSize = 1000` batchSize = 1000
`
func (k *Kafka) SampleConfig() string { func (k *Kafka) SampleConfig() string {
return sampleConfig return sampleConfig

View File

@ -29,7 +29,8 @@ var sampleConfig = `
# If not specified, the default will work on Lustre 2.5.x # If not specified, the default will work on Lustre 2.5.x
# #
# ost_procfiles = ["/proc/fs/lustre/obdfilter/*/stats", "/proc/fs/lustre/osd-ldiskfs/*/stats"] # ost_procfiles = ["/proc/fs/lustre/obdfilter/*/stats", "/proc/fs/lustre/osd-ldiskfs/*/stats"]
# mds_procfiles = ["/proc/fs/lustre/mdt/*/md_stats"]` # mds_procfiles = ["/proc/fs/lustre/mdt/*/md_stats"]
`
/* The wanted fields would be a []string if not for the /* The wanted fields would be a []string if not for the
lines that start with read_bytes/write_bytes and contain lines that start with read_bytes/write_bytes and contain

View File

@ -21,7 +21,8 @@ var sampleConfig = `
# with optional port. ie localhost, 10.0.0.1:11211, etc. # with optional port. ie localhost, 10.0.0.1:11211, etc.
# #
# If no servers are specified, then localhost is used as the host. # If no servers are specified, then localhost is used as the host.
servers = ["localhost"]` servers = ["localhost"]
`
var defaultTimeout = 5 * time.Second var defaultTimeout = 5 * time.Second

View File

@ -30,7 +30,8 @@ var sampleConfig = `
# mongodb://10.10.3.33:18832, 10.0.0.1:10000, etc. # mongodb://10.10.3.33:18832, 10.0.0.1:10000, etc.
# #
# If no servers are specified, then 127.0.0.1 is used as the host and 27107 as the port. # If no servers are specified, then 127.0.0.1 is used as the host and 27107 as the port.
servers = ["127.0.0.1:27017"]` servers = ["127.0.0.1:27017"]
`
func (m *MongoDB) SampleConfig() string { func (m *MongoDB) SampleConfig() string {
return sampleConfig return sampleConfig

View File

@ -21,7 +21,8 @@ var sampleConfig = `
# root:passwd@tcp(127.0.0.1:3036)/ # root:passwd@tcp(127.0.0.1:3036)/
# #
# If no servers are specified, then localhost is used as the host. # If no servers are specified, then localhost is used as the host.
servers = ["localhost"]` servers = ["localhost"]
`
func (m *Mysql) SampleConfig() string { func (m *Mysql) SampleConfig() string {
return sampleConfig return sampleConfig

View File

@ -20,7 +20,8 @@ type Nginx struct {
var sampleConfig = ` var sampleConfig = `
# An array of Nginx stub_status URI to gather stats. # An array of Nginx stub_status URI to gather stats.
urls = ["http://localhost/status"]` urls = ["http://localhost/status"]
`
func (n *Nginx) SampleConfig() string { func (n *Nginx) SampleConfig() string {
return sampleConfig return sampleConfig

View File

@ -18,7 +18,8 @@ type Prometheus struct {
var sampleConfig = ` var sampleConfig = `
# An array of urls to scrape metrics from. # An array of urls to scrape metrics from.
urls = ["http://localhost:9100/metrics"]` urls = ["http://localhost:9100/metrics"]
`
func (r *Prometheus) SampleConfig() string { func (r *Prometheus) SampleConfig() string {
return sampleConfig return sampleConfig

View File

@ -26,7 +26,8 @@ var sampleConfig = `
# 10.0.0.1:10000, etc. # 10.0.0.1:10000, etc.
# #
# If no servers are specified, then localhost is used as the host. # If no servers are specified, then localhost is used as the host.
servers = ["localhost"]` servers = ["localhost"]
`
func (r *Redis) SampleConfig() string { func (r *Redis) SampleConfig() string {
return sampleConfig return sampleConfig

View File

@ -20,7 +20,8 @@ var sampleConfig = `
# rethinkdb://10.10.3.33:18832, 10.0.0.1:10000, etc. # rethinkdb://10.10.3.33:18832, 10.0.0.1:10000, etc.
# #
# If no servers are specified, then 127.0.0.1 is used as the host and 28015 as the port. # If no servers are specified, then 127.0.0.1 is used as the host and 28015 as the port.
servers = ["127.0.0.1:28015"]` servers = ["127.0.0.1:28015"]
`
func (r *RethinkDB) SampleConfig() string { func (r *RethinkDB) SampleConfig() string {
return sampleConfig return sampleConfig

View File

@ -29,7 +29,8 @@ var sampleConfig = `
# Whether to report per-cpu stats or not # Whether to report per-cpu stats or not
percpu = true percpu = true
# Whether to report total system cpu stats or not # Whether to report total system cpu stats or not
totalcpu = true` totalcpu = true
`
func (_ *CPUStats) SampleConfig() string { func (_ *CPUStats) SampleConfig() string {
return sampleConfig return sampleConfig