Skip to content
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

Telegraph Docker Input Plugin : per docker running status support #4259

Merged
merged 8 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions plugins/inputs/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,17 @@ func (d *Docker) gatherContainer(
}
}
}
if info.State != nil {
tags["container_status"] = info.State.Status
statefields := map[string]interface{}{
"oomkilled": info.State.OOMKilled,
"pid": info.State.Pid,
"exitcode": info.State.ExitCode,
"started_at": info.State.StartedAt,
"finished_at": info.State.FinishedAt,
}
acc.AddFields("docker_container_status", statefields, tags, time.Now())
}

if info.State.Health != nil {
healthfields := map[string]interface{}{
Expand Down
2 changes: 2 additions & 0 deletions plugins/inputs/docker/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ func TestDockerGatherInfo(t *testing.T) {
"label1": "test_value_1",
"label2": "test_value_2",
"server_version": "17.09.0-ce",
"container_status": "running",
},
)
acc.AssertContainsTaggedFields(t,
Expand All @@ -676,6 +677,7 @@ func TestDockerGatherInfo(t *testing.T) {
"label1": "test_value_1",
"label2": "test_value_2",
"server_version": "17.09.0-ce",
"container_status": "running",
},
)
}
Expand Down