Fix build on Windows (#2972)
This commit is contained in:
parent
8bd9ac8697
commit
bd78b8e1b3
|
@ -3,11 +3,13 @@ package system
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"path"
|
||||||
|
|
||||||
"github.com/influxdata/telegraf"
|
"github.com/influxdata/telegraf"
|
||||||
"github.com/influxdata/telegraf/plugins/inputs"
|
"github.com/influxdata/telegraf/plugins/inputs"
|
||||||
"path"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// https://www.kernel.org/doc/Documentation/sysctl/fs.txt
|
// https://www.kernel.org/doc/Documentation/sysctl/fs.txt
|
||||||
|
@ -80,6 +82,14 @@ func (sfs *SysctlFS) Gather(acc telegraf.Accumulator) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetHostProc() string {
|
||||||
|
procPath := "/proc"
|
||||||
|
if os.Getenv("HOST_PROC") != "" {
|
||||||
|
procPath = os.Getenv("HOST_PROC")
|
||||||
|
}
|
||||||
|
return procPath
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
||||||
inputs.Add("linux_sysctl_fs", func() telegraf.Input {
|
inputs.Add("linux_sysctl_fs", func() telegraf.Input {
|
||||||
|
|
|
@ -20,7 +20,6 @@ import (
|
||||||
|
|
||||||
type Processes struct {
|
type Processes struct {
|
||||||
execPS func() ([]byte, error)
|
execPS func() ([]byte, error)
|
||||||
getHostProc func() string
|
|
||||||
readProcFile func(filename string) ([]byte, error)
|
readProcFile func(filename string) ([]byte, error)
|
||||||
|
|
||||||
forcePS bool
|
forcePS bool
|
||||||
|
@ -63,14 +62,6 @@ func (p *Processes) Gather(acc telegraf.Accumulator) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetHostProc() string {
|
|
||||||
procPath := "/proc"
|
|
||||||
if os.Getenv("HOST_PROC") != "" {
|
|
||||||
procPath = os.Getenv("HOST_PROC")
|
|
||||||
}
|
|
||||||
return procPath
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gets empty fields of metrics based on the OS
|
// Gets empty fields of metrics based on the OS
|
||||||
func getEmptyFields() map[string]interface{} {
|
func getEmptyFields() map[string]interface{} {
|
||||||
fields := map[string]interface{}{
|
fields := map[string]interface{}{
|
||||||
|
|
Loading…
Reference in New Issue