Skip to content

Commit

Permalink
Merge branch 'influx' of https://github.com/arstercz/telegraf into in…
Browse files Browse the repository at this point in the history
…flux
  • Loading branch information
arstercz committed Dec 25, 2023
2 parents c43e58c + 465763e commit 01d8036
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/inputs/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ status if configured.
- container_version
- fields:
- container_status (integer, 1 = created, 2 = running, 3 = paused, 4 = restarting, 5 = removing, 6 = exited, 7 = dead)
- health_status (integer, 0 = Unhealthy, 1 = Healthy, 2 = Starting)
- health_status (integer, 0 = Unhealthy, 1 = Healthy, 2 = Starting, 4 = NoHealthcheck)
- failing_streak (integer)

- docker_container_status
Expand Down
10 changes: 7 additions & 3 deletions plugins/inputs/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,12 +643,16 @@ func (d *Docker) gatherContainerInspect(
}
healthStatusVal := -1
switch info.State.Health.Status {
case "Starting":
case types.NoHealthcheck:
healthStatusVal = 3
case types.Starting:
healthStatusVal = 2
case "Healthy":
case types.Healthy:
healthStatusVal = 1
case "Unhealthy":
case types.Unhealthy:
healthStatusVal = 0
default:
d.Log.Warn("docker: unknown health status [%s]", info.State.Health.Status)
}
healthfields["health_status"] = healthStatusVal
acc.AddFields("docker_container_health", healthfields, tags, now())
Expand Down

0 comments on commit 01d8036

Please sign in to comment.