parent
1d4843bc8e
commit
8a1b070e2f
|
@ -110,6 +110,7 @@ be deprecated eventually.
|
|||
- [#2671](https://github.com/influxdata/telegraf/issues/2671): The internal input plugin uses the wrong units for `heap_objects`
|
||||
- [#2684](https://github.com/influxdata/telegraf/pull/2684): Fix ipmi_sensor config is shared between all plugin instances
|
||||
- [#2450](https://github.com/influxdata/telegraf/issues/2450): Network statistics not collected when system has alias interfaces
|
||||
- [#1911](https://github.com/influxdata/telegraf/issues/1911): Sysstat plugin needs LANG=C or similar locale
|
||||
|
||||
## v1.2.1 [2017-02-01]
|
||||
|
||||
|
|
|
@ -210,11 +210,37 @@ func (s *Sysstat) collect() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func filterEnviron(env []string, prefix string) []string {
|
||||
newenv := env[:0]
|
||||
for _, envvar := range env {
|
||||
if !strings.HasPrefix(envvar, prefix) {
|
||||
newenv = append(newenv, envvar)
|
||||
}
|
||||
}
|
||||
return newenv
|
||||
}
|
||||
|
||||
// Return the Cmd with its environment configured to use the C locale
|
||||
func withCLocale(cmd *exec.Cmd) *exec.Cmd {
|
||||
var env []string
|
||||
if cmd.Env != nil {
|
||||
env = cmd.Env
|
||||
} else {
|
||||
env = os.Environ()
|
||||
}
|
||||
env = filterEnviron(env, "LANG")
|
||||
env = filterEnviron(env, "LC_")
|
||||
env = append(env, "LANG=C")
|
||||
cmd.Env = env
|
||||
return cmd
|
||||
}
|
||||
|
||||
// parse runs Sadf on the previously saved tmpFile:
|
||||
// Sadf -p -- -p <option> tmpFile
|
||||
// and parses the output to add it to the telegraf.Accumulator acc.
|
||||
func (s *Sysstat) parse(acc telegraf.Accumulator, option string, ts time.Time) error {
|
||||
cmd := execCommand(s.Sadf, s.sadfOptions(option)...)
|
||||
cmd = withCLocale(cmd)
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -15,6 +15,9 @@ import (
|
|||
// run with -race option, because in that scenario interval between the two
|
||||
// Gather calls is greater than wantedInterval.
|
||||
func TestInterval(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping test with sleep in short mode.")
|
||||
}
|
||||
// overwriting exec commands with mock commands
|
||||
execCommand = fakeExecCommand
|
||||
defer func() { execCommand = exec.Command }()
|
||||
|
|
Loading…
Reference in New Issue