Werk #18020: docker_container_status_health: fix check when health logs are empty

Component Checks & agents
Title docker_container_status_health: fix check when health logs are empty
Date May 6, 2025
Level Trivial Change
Class Bug Fix
Compatibility Compatible - no manual interaction needed
Checkmk versions & editions
2.5.0b1
Not yet released
Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)
2.4.0p1
Not yet released
Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)
2.3.0p32
Not yet released
Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)

The check plugin crashed with the error

  File "/omd/sites/site_name/lib/python3/cmk/base/plugins/agent_based/docker_container_status.py", line 183, in check_docker_container_status_health
    last_log = health.get("Log", [{}])[-1]

This happened because the Log field in Docker's health check status can be an empty list ("Log": []) when a health check is defined but has not yet produced any results - this can typically occur during the initial startup period.

To the list of all Werks