diff --git a/plugins/inputs/mesos/mesos.go b/plugins/inputs/mesos/mesos.go index c53fc65c9..843ebb0ef 100644 --- a/plugins/inputs/mesos/mesos.go +++ b/plugins/inputs/mesos/mesos.go @@ -18,8 +18,8 @@ import ( type Mesos struct { Timeout int - Servers []string - MetricsCol []string `toml:"metrics_collection"` + Masters []string + MasterCols []string `toml:"metrics_collection"` } var defaultMetrics = []string{ @@ -33,10 +33,10 @@ var sampleConfig = ` # A list of Mesos masters. e.g. master1:5050, master2:5080, etc. # The port can be skipped if using the default (5050) # Default value is localhost:5050. - servers = ["localhost:5050"] + masters = ["localhost:5050"] # Metrics groups to be collected. # Default, all enabled. - metrics_collection = ["resources","master","system","slaves","frameworks","messages","evqueue","registrar"] + master_collections = ["resources","master","system","slaves","frameworks","messages","evqueue","registrar"] ` // SampleConfig returns a sample configuration block @@ -54,13 +54,13 @@ func (m *Mesos) Gather(acc telegraf.Accumulator) error { var wg sync.WaitGroup var errorChannel chan error - if len(m.Servers) == 0 { - m.Servers = []string{"localhost:5050"} + if len(m.Masters) == 0 { + m.Masters = []string{"localhost:5050"} } - errorChannel = make(chan error, len(m.Servers)*2) + errorChannel = make(chan error, len(m.Masters)*2) - for _, v := range m.Servers { + for _, v := range m.Masters { wg.Add(1) go func() { errorChannel <- m.gatherMetrics(v, acc) @@ -253,7 +253,7 @@ func masterBlocks(g string) []string { func (m *Mesos) removeGroup(j *map[string]interface{}) { var ok bool - b := metricsDiff(m.MetricsCol) + b := metricsDiff(m.MasterCols) for _, k := range b { for _, v := range masterBlocks(k) { diff --git a/plugins/inputs/mesos/mesos_test.go b/plugins/inputs/mesos/mesos_test.go index 297e0d2b8..3c9d0ca6d 100644 --- a/plugins/inputs/mesos/mesos_test.go +++ b/plugins/inputs/mesos/mesos_test.go @@ -74,7 +74,7 @@ func TestMesosMaster(t *testing.T) { var acc testutil.Accumulator m := Mesos{ - Servers: []string{ts.Listener.Addr().String()}, + Masters: []string{ts.Listener.Addr().String()}, Timeout: 10, } @@ -91,7 +91,7 @@ func TestRemoveGroup(t *testing.T) { generateMetrics() m := Mesos{ - MetricsCol: []string{ + MasterCols: []string{ "resources", "master", "registrar", }, } @@ -109,7 +109,7 @@ func TestRemoveGroup(t *testing.T) { } } } - for _, v := range m.MetricsCol { + for _, v := range m.MasterCols { for _, x := range masterBlocks(v) { if _, ok := mesosMetrics[x]; !ok { t.Errorf("Didn't find key %s, it should present.", x) @@ -135,10 +135,10 @@ func TestSampleConfig(t *testing.T) { # A list of Mesos masters. e.g. master1:5050, master2:5080, etc. # The port can be skipped if using the default (5050) # Default value is localhost:5050. - servers = ["localhost:5050"] + masters = ["localhost:5050"] # Metrics groups to be collected. # Default, all enabled. - metrics_collection = ["resources","master","system","slaves","frameworks","messages","evqueue","registrar"] + master_collections = ["resources","master","system","slaves","frameworks","messages","evqueue","registrar"] ` got := new(Mesos).SampleConfig()