From d99a46effe7360fd6cd7c43d84375546d155530a Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Tue, 20 Nov 2018 11:08:37 +0100 Subject: [PATCH 1/2] Fix panic on docker healthcheck collection on dockers without healthchecks --- CHANGELOG.asciidoc | 1 + metricbeat/module/docker/healthcheck/data.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index d329e808ec47..d18b07f6a706 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -44,6 +44,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha1...master[Check the HEAD d *Metricbeat* - Fix issue preventing diskio metrics collection for idle disks. {issue}9124[9124] {pull}9125[9125] +- Fix panic on docker healthcheck collection on dockers without healthchecks. {pull}[] *Packetbeat* diff --git a/metricbeat/module/docker/healthcheck/data.go b/metricbeat/module/docker/healthcheck/data.go index 0b745827600c..dc91093c9186 100644 --- a/metricbeat/module/docker/healthcheck/data.go +++ b/metricbeat/module/docker/healthcheck/data.go @@ -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 From c636919db892c5e512bdbd74c8099f907dfa5154 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Tue, 20 Nov 2018 16:37:56 +0100 Subject: [PATCH 2/2] Fix changelog --- CHANGELOG.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index d18b07f6a706..cc853aca9c73 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -44,7 +44,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha1...master[Check the HEAD d *Metricbeat* - Fix issue preventing diskio metrics collection for idle disks. {issue}9124[9124] {pull}9125[9125] -- Fix panic on docker healthcheck collection on dockers without healthchecks. {pull}[] +- Fix panic on docker healthcheck collection on dockers without healthchecks. {pull}9171[9171] *Packetbeat*