Modernize CheckDocker and add stats, restarts and disk-usage checks - #1400
Merged
Conversation
The module had never worked on Linux: the http client had no unix domain socket transport, so the "pipe" protocol fell back to TCP and tried to DNS-resolve /var/run/docker.sock. It had also stopped working on current daemons on Windows, which reject its pinned /v1.40 API prefix (minimum is 1.41 now), and any failure was swallowed into an empty WARNING. - net/http: new unix_socket transport (with the same read/write deadlines as TCP); "pipe" now means named pipe on Windows and unix socket elsewhere. - check_docker: unversioned API paths (accepted by every daemon and podman's compat API); UNKNOWN with the transport error instead of an empty WARNING; tolerant JSON parsing (sparse payloads no longer throw); all=true to include stopped containers; container=<name> require-semantics with a synthetic 'missing' state; new keywords health, has_health_check, ports, labels, created, multi-network ip; /settings/docker endpoint + timeout. - New check_docker_info: daemon health from /info (version plus container/image counts with perf data). - New check_docker_stats: per-container CPU%% and memory versus limit, computed like docker stats (cgroup v1 and v2). - New check_docker_restarts: crash-loop and OOM detection; default warning on restart_count > 3 with a recent start, critical on oom_killed. - New check_docker_df: docker system df as a check, with reclaimable-space keywords; size thresholds accept units (total_reclaimable > 10G). - Ship CheckDocker.dll in the MSI and add it to the feature-hint map; drop the dead log/metrics stubs. Covered by 24 unit tests (canned daemon payloads via an injectable fetcher) and a 13-case integration suite against a real daemon; all scenarios also verified live against Docker 29.5.3, including a real crash-looping container. Assisted-by: Claude Code:claude-fable-5 Signed-off-by: Michael Medin <michael@medin.name>
The CheckDocker unit tests configured /var/run/docker.sock as the daemon endpoint on every platform. Since the checks validate the endpoint before they call the (injected) fetcher, on Windows all 23 fake-daemon tests were refused with "only a local named pipe ... is allowed" and never reached the canned payloads, failing the three Windows CI builds. Configure the endpoint from default_docker_endpoint() instead, which is the unix socket path elsewhere and \\.\pipe\docker_engine on Windows, and derive the expected connect-failure message from it too. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Michael Medin <michael@medin.name>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.