-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feat(inputs.system): Add operating-system information #18834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b44f059
feat(inputs.system): Add 'os' include group with platform and kernel
bilkoua ca8de94
feat(inputs.system): Add 'os' include group with platform and kernel
bilkoua c013035
Merge branch 'influxdata:master' into master
bilkoua 8ecc7ef
fix linter
bilkoua e6bccb9
fix lint
bilkoua bfb0416
Update plugins/inputs/system/system.go
bilkoua 5bada92
apply review feedback
bilkoua 6111182
Update plugins/inputs/system/system.go
bilkoua 8773ec0
Update plugins/inputs/system/system.go
bilkoua 2902f60
review feedback
bilkoua bb47138
resolve merge conflicts
bilkoua c65e346
return KernelArch
bilkoua be5b87e
review feedback
bilkoua File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
bilkoua marked this conversation as resolved.
Outdated
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| //go:build linux | ||
|
|
||
| package system | ||
|
|
||
| import ( | ||
| "path/filepath" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
|
|
||
| "github.com/influxdata/telegraf" | ||
| "github.com/influxdata/telegraf/config" | ||
| "github.com/influxdata/telegraf/metric" | ||
| "github.com/influxdata/telegraf/testutil" | ||
| ) | ||
|
|
||
| func TestGatherOSValuesLinux(t *testing.T) { | ||
| etcDir, err := filepath.Abs(filepath.Join("testdata", "os-release")) | ||
| require.NoError(t, err) | ||
| t.Setenv("HOST_ETC", etcDir) | ||
|
|
||
| s := &System{ | ||
| Include: []string{"os"}, | ||
| OSCacheTTL: config.Duration(8 * time.Hour), | ||
| Log: &testutil.Logger{}, | ||
| } | ||
| require.NoError(t, s.Init()) | ||
|
|
||
| var acc testutil.Accumulator | ||
| require.NoError(t, s.Gather(&acc)) | ||
|
|
||
| expected := []telegraf.Metric{ | ||
| metric.New( | ||
| "system_os", | ||
| map[string]string{}, | ||
| map[string]interface{}{ | ||
| "os": "linux", | ||
| "arch": "amd64", | ||
| "platform": "telegraftest", | ||
| "platform_family": "", | ||
| "platform_version": "1.0", | ||
| "kernel_version": "", | ||
| }, | ||
| time.Unix(0, 0), | ||
| telegraf.Untyped, | ||
| ), | ||
| } | ||
|
|
||
| testutil.RequireMetricsStructureEqual(t, expected, acc.GetTelegrafMetrics(), testutil.IgnoreTime()) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| NAME="Telegraf Test OS" | ||
| ID=telegraftest | ||
| VERSION_ID="1.0" | ||
| PRETTY_NAME="Telegraf Test OS 1.0" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.