Skip to content

Commit

Permalink
Fix panic on docker healthcheck collection (#9171) (#9181)
Browse files Browse the repository at this point in the history
Fix panic on docker healthcheck collection on dockers without healthchecks.

(cherry picked from commit 1c43d6c)
  • Loading branch information
jsoriano authored Nov 23, 2018
1 parent fd3a205 commit d56700d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ https://github.com/elastic/beats/compare/v6.5.1...6.5[Check the HEAD diff]

*Metricbeat*

- Fix panic on docker healthcheck collection on dockers without healthchecks. {pull}9171[9171]
- Fix issue preventing diskio metrics collection for idle disks. {issue}9124[9124] {pull}9125[9125]

*Packetbeat*
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/module/docker/healthcheck/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ func eventMapping(cont *types.Container, m *MetricSet) common.MapStr {
logp.Err("Error inspecting container %v: %v", cont.ID, err)
return nil
}

// Check if the container has any health check
if container.State.Health == nil {
return nil
}

lastEvent := len(container.State.Health.Log) - 1

// Checks if a healthcheck already happened
Expand Down

0 comments on commit d56700d

Please sign in to comment.