Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
da077315
Commit
da077315
authored
7 years ago
by
Daniel Nelson
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use C locale when running sadf (#2690)
fixes #1911
parent
38e1c1de
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
plugins/inputs/sysstat/sysstat.go
+26
-0
26 additions, 0 deletions
plugins/inputs/sysstat/sysstat.go
plugins/inputs/sysstat/sysstat_interval_test.go
+3
-0
3 additions, 0 deletions
plugins/inputs/sysstat/sysstat_interval_test.go
with
30 additions
and
0 deletions
CHANGELOG.md
+
1
−
0
View file @
da077315
...
@@ -110,6 +110,7 @@ be deprecated eventually.
...
@@ -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`
-
[
#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
-
[
#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
-
[
#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]
## v1.2.1 [2017-02-01]
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/sysstat/sysstat.go
+
26
−
0
View file @
da077315
...
@@ -210,11 +210,37 @@ func (s *Sysstat) collect() error {
...
@@ -210,11 +210,37 @@ func (s *Sysstat) collect() error {
return
nil
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:
// parse runs Sadf on the previously saved tmpFile:
// Sadf -p -- -p <option> tmpFile
// Sadf -p -- -p <option> tmpFile
// and parses the output to add it to the telegraf.Accumulator acc.
// 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
{
func
(
s
*
Sysstat
)
parse
(
acc
telegraf
.
Accumulator
,
option
string
,
ts
time
.
Time
)
error
{
cmd
:=
execCommand
(
s
.
Sadf
,
s
.
sadfOptions
(
option
)
...
)
cmd
:=
execCommand
(
s
.
Sadf
,
s
.
sadfOptions
(
option
)
...
)
cmd
=
withCLocale
(
cmd
)
stdout
,
err
:=
cmd
.
StdoutPipe
()
stdout
,
err
:=
cmd
.
StdoutPipe
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/sysstat/sysstat_interval_test.go
+
3
−
0
View file @
da077315
...
@@ -15,6 +15,9 @@ import (
...
@@ -15,6 +15,9 @@ import (
// run with -race option, because in that scenario interval between the two
// run with -race option, because in that scenario interval between the two
// Gather calls is greater than wantedInterval.
// Gather calls is greater than wantedInterval.
func
TestInterval
(
t
*
testing
.
T
)
{
func
TestInterval
(
t
*
testing
.
T
)
{
if
testing
.
Short
()
{
t
.
Skip
(
"Skipping test with sleep in short mode."
)
}
// overwriting exec commands with mock commands
// overwriting exec commands with mock commands
execCommand
=
fakeExecCommand
execCommand
=
fakeExecCommand
defer
func
()
{
execCommand
=
exec
.
Command
}()
defer
func
()
{
execCommand
=
exec
.
Command
}()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment