Create public models for telegraf metrics, accumlator, plugins
This will basically make the root directory a place for storing the major telegraf interfaces, which will make telegraf's godoc looks quite a bit nicer. And make it easier for contributors to lookup the few data types that they actually care about. closes #564
This commit is contained in:
@@ -3,6 +3,7 @@ package system
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
)
|
||||
|
||||
@@ -16,7 +17,7 @@ func (_ *MemStats) Description() string {
|
||||
|
||||
func (_ *MemStats) SampleConfig() string { return "" }
|
||||
|
||||
func (s *MemStats) Gather(acc inputs.Accumulator) error {
|
||||
func (s *MemStats) Gather(acc telegraf.Accumulator) error {
|
||||
vm, err := s.ps.VMStat()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting virtual memory info: %s", err)
|
||||
@@ -47,7 +48,7 @@ func (_ *SwapStats) Description() string {
|
||||
|
||||
func (_ *SwapStats) SampleConfig() string { return "" }
|
||||
|
||||
func (s *SwapStats) Gather(acc inputs.Accumulator) error {
|
||||
func (s *SwapStats) Gather(acc telegraf.Accumulator) error {
|
||||
swap, err := s.ps.SwapStat()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting swap memory info: %s", err)
|
||||
@@ -67,11 +68,11 @@ func (s *SwapStats) Gather(acc inputs.Accumulator) error {
|
||||
}
|
||||
|
||||
func init() {
|
||||
inputs.Add("mem", func() inputs.Input {
|
||||
inputs.Add("mem", func() telegraf.Input {
|
||||
return &MemStats{ps: &systemPS{}}
|
||||
})
|
||||
|
||||
inputs.Add("swap", func() inputs.Input {
|
||||
inputs.Add("swap", func() telegraf.Input {
|
||||
return &SwapStats{ps: &systemPS{}}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user