feat(agent): send the CPU count and the Docker state in the status - #49
Merged
Merged
Conversation
nabil1440
added this pull request to stack #38
September 24, 2026 06:06
nabil1440
marked this pull request as ready for review
September 24, 2026 06:07
nabil1440
force-pushed
the
agent/44-docker-status
branch
from
September 24, 2026 08:09
4c1d3b2 to
f008dd0
Compare
Contract v0.5.0, "status: the CPU count and Docker": cpu_count from the cpuN lines of /proc/stat, and docker_status and docker_version from GET /version on the Docker socket, with a limit of 5 seconds. The new package dockerapi uses only the Go standard library, and sends only GET /version and GET /containers/json. Closes #44
nabil1440
force-pushed
the
agent/44-docker-status
branch
from
September 24, 2026 08:14
f008dd0 to
bf7119d
Compare
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.
Closes #44.
Part of the monitoring agent stack. This PR is on top of #48. Contract v0.5.0, "
status: the CPU count and Docker".What changes
status.cpu_count: the number ofcpuNlines in/proc/stat.internal/dockerapi. A client for the Docker Engine API on the unix socket, with the Go standard library only. It sends onlyGET /versionandGET /containers/json, with a limit of 5 seconds for each request. It does not use thedockercommand.status.docker_status, in the order of the contract:runningwhenGET /versionanswersnot_runningwhen there is no socket, or the connection is refused, and/usr/bin/dockerdexistsnot_installedin the same case without/usr/bin/dockerdnullfor each other result, for example "permission denied" or no answer in 5 seconds. The agent writes one warning.status.docker_version: theVersionof the answer, only whendocker_statusisrunning.cpu_count1 to 4096, a knowndocker_status, and adocker_versionof at most 32 characters.Caution
Tests
dockerd, a refused connection, a socket that refuses the user, and no answer.make checkpasses.