move plugin interfaces into separate package
This commit is contained in:
@@ -9,11 +9,11 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins"
|
||||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
)
|
||||
|
||||
func (z *Zfs) gatherPoolStats(acc telegraf.Accumulator) (string, error) {
|
||||
func (z *Zfs) gatherPoolStats(acc plugins.Accumulator) (string, error) {
|
||||
|
||||
lines, err := z.zpool()
|
||||
if err != nil {
|
||||
@@ -76,7 +76,7 @@ func (z *Zfs) gatherPoolStats(acc telegraf.Accumulator) (string, error) {
|
||||
return strings.Join(pools, "::"), nil
|
||||
}
|
||||
|
||||
func (z *Zfs) Gather(acc telegraf.Accumulator) error {
|
||||
func (z *Zfs) Gather(acc plugins.Accumulator) error {
|
||||
kstatMetrics := z.KstatMetrics
|
||||
if len(kstatMetrics) == 0 {
|
||||
kstatMetrics = []string{"arcstats", "zfetchstats", "vdev_cache_stats"}
|
||||
@@ -131,7 +131,7 @@ func sysctl(metric string) ([]string, error) {
|
||||
}
|
||||
|
||||
func init() {
|
||||
inputs.Add("zfs", func() telegraf.Input {
|
||||
inputs.Add("zfs", func() plugins.Input {
|
||||
return &Zfs{
|
||||
sysctl: sysctl,
|
||||
zpool: zpool,
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins"
|
||||
"github.com/influxdata/telegraf/internal"
|
||||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
)
|
||||
@@ -44,7 +44,7 @@ func getTags(pools []poolInfo) map[string]string {
|
||||
return map[string]string{"pools": poolNames}
|
||||
}
|
||||
|
||||
func gatherPoolStats(pool poolInfo, acc telegraf.Accumulator) error {
|
||||
func gatherPoolStats(pool poolInfo, acc plugins.Accumulator) error {
|
||||
lines, err := internal.ReadLines(pool.ioFilename)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -77,7 +77,7 @@ func gatherPoolStats(pool poolInfo, acc telegraf.Accumulator) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (z *Zfs) Gather(acc telegraf.Accumulator) error {
|
||||
func (z *Zfs) Gather(acc plugins.Accumulator) error {
|
||||
kstatMetrics := z.KstatMetrics
|
||||
if len(kstatMetrics) == 0 {
|
||||
kstatMetrics = []string{"arcstats", "zfetchstats", "vdev_cache_stats"}
|
||||
@@ -125,7 +125,7 @@ func (z *Zfs) Gather(acc telegraf.Accumulator) error {
|
||||
}
|
||||
|
||||
func init() {
|
||||
inputs.Add("zfs", func() telegraf.Input {
|
||||
inputs.Add("zfs", func() plugins.Input {
|
||||
return &Zfs{}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
package zfs
|
||||
|
||||
import (
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins"
|
||||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
)
|
||||
|
||||
func (z *Zfs) Gather(acc telegraf.Accumulator) error {
|
||||
func (z *Zfs) Gather(acc plugins.Accumulator) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
inputs.Add("zfs", func() telegraf.Input {
|
||||
inputs.Add("zfs", func() plugins.Input {
|
||||
return &Zfs{}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user