Move from `inputs.Input` to `telegraf.Input` interface.
Signed-off-by: Ryan Merrick <ryan.merrick@ryanmerrick.co.uk>
This commit is contained in:
parent
dc6efce3c2
commit
ec95e4b5ea
|
@ -5,6 +5,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/influxdata/telegraf"
|
||||||
"github.com/influxdata/telegraf/plugins/inputs"
|
"github.com/influxdata/telegraf/plugins/inputs"
|
||||||
"github.com/rmanocha/go_newrelic_api"
|
"github.com/rmanocha/go_newrelic_api"
|
||||||
)
|
)
|
||||||
|
@ -63,7 +64,7 @@ func (nr *NewRelic) SampleConfig() string {
|
||||||
return sampleConfig
|
return sampleConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nr *NewRelic) GatherServerAverages(acc inputs.Accumulator, nrapi *go_newrelic_api.Newrelic) error {
|
func (nr *NewRelic) GatherServerAverages(acc telegraf.Accumulator, nrapi *go_newrelic_api.Newrelic) error {
|
||||||
dataserver := nrapi.GetServers()
|
dataserver := nrapi.GetServers()
|
||||||
|
|
||||||
for v := range dataserver.Servers {
|
for v := range dataserver.Servers {
|
||||||
|
@ -88,7 +89,7 @@ func (nr *NewRelic) GatherServerAverages(acc inputs.Accumulator, nrapi *go_newre
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nr *NewRelic) GatherApplicationAverages(acc inputs.Accumulator, nrapi *go_newrelic_api.Newrelic) error {
|
func (nr *NewRelic) GatherApplicationAverages(acc telegraf.Accumulator, nrapi *go_newrelic_api.Newrelic) error {
|
||||||
dataapplication := nrapi.GetApplication(nr.APPID)
|
dataapplication := nrapi.GetApplication(nr.APPID)
|
||||||
|
|
||||||
fieldsApplication := map[string]interface{}{
|
fieldsApplication := map[string]interface{}{
|
||||||
|
@ -112,12 +113,12 @@ func (nr *NewRelic) GatherApplicationAverages(acc inputs.Accumulator, nrapi *go_
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nr *NewRelic) GatherMetrics(acc inputs.Accumulator, nrapi *go_newrelic_api.Newrelic) error {
|
func (nr *NewRelic) GatherMetrics(acc telegraf.Accumulator, nrapi *go_newrelic_api.Newrelic) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gather requested metrics
|
// Gather requested metrics
|
||||||
func (nr *NewRelic) Gather(acc inputs.Accumulator) error {
|
func (nr *NewRelic) Gather(acc telegraf.Accumulator) error {
|
||||||
conn := go_newrelic_api.NewNewrelic(nr.APIKey)
|
conn := go_newrelic_api.NewNewrelic(nr.APIKey)
|
||||||
|
|
||||||
if nr.PollServerAverages {
|
if nr.PollServerAverages {
|
||||||
|
@ -176,5 +177,5 @@ func (nr *NewRelic) Gather(acc inputs.Accumulator) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
inputs.Add("newrelic", func() inputs.Input { return &NewRelic{} })
|
inputs.Add("newrelic", func() telegraf.Input { return &NewRelic{} })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue