telegraf/plugins/inputs/synproxy/synproxy.go

41 lines
702 B
Go
Raw Normal View History

2019-11-21 19:26:59 +00:00
package synproxy
import (
"os"
"path"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
type Synproxy struct {
Log telegraf.Logger `toml:"-"`
2019-11-21 19:26:59 +00:00
// Synproxy stats filename (proc filesystem)
statFile string
}
func (k *Synproxy) Description() string {
return "Get synproxy counter statistics from procfs"
}
func (k *Synproxy) SampleConfig() string {
return ""
}
func getHostProc() string {
procPath := "/proc"
if os.Getenv("HOST_PROC") != "" {
procPath = os.Getenv("HOST_PROC")
}
return procPath
}
func init() {
inputs.Add("synproxy", func() telegraf.Input {
return &Synproxy{
statFile: path.Join(getHostProc(), "/net/stat/synproxy"),
}
})
}