Fix compilation errors
This commit is contained in:
parent
6a6db3430f
commit
6591b6bb00
|
@ -9,6 +9,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/influxdata/telegraf"
|
||||||
"github.com/influxdata/telegraf/plugins/inputs"
|
"github.com/influxdata/telegraf/plugins/inputs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ func (p *Powerdns) Description() string {
|
||||||
return "Read metrics from one or many PowerDNS servers"
|
return "Read metrics from one or many PowerDNS servers"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Powerdns) Gather(acc inputs.Accumulator) error {
|
func (p *Powerdns) Gather(acc telegraf.Accumulator) error {
|
||||||
if len(p.UnixSockets) == 0 {
|
if len(p.UnixSockets) == 0 {
|
||||||
return p.gatherServer("/var/run/pdns.controlsocket", acc)
|
return p.gatherServer("/var/run/pdns.controlsocket", acc)
|
||||||
}
|
}
|
||||||
|
@ -48,7 +49,7 @@ func (p *Powerdns) Gather(acc inputs.Accumulator) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Powerdns) gatherServer(address string, acc inputs.Accumulator) error {
|
func (p *Powerdns) gatherServer(address string, acc telegraf.Accumulator) error {
|
||||||
conn, err := net.DialTimeout("unix", address, defaultTimeout)
|
conn, err := net.DialTimeout("unix", address, defaultTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -119,7 +120,7 @@ func parseResponse(metrics string) (map[string]interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
inputs.Add("powerdns", func() inputs.Input {
|
inputs.Add("powerdns", func() telegraf.Input {
|
||||||
return &Powerdns{}
|
return &Powerdns{}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ func TestPowerdnsParseMetrics(t *testing.T) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if value != test.value {
|
if value != test.value {
|
||||||
t.Errorf("Metric: %s, Expected: %s, actual: %s",
|
t.Errorf("Metric: %s, Expected: %d, actual: %d",
|
||||||
test.key, test.value, value)
|
test.key, test.value, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue