Skip to content

feat(agent): send the CPU count and the Docker state in the status - #49

Merged
nabil1440 merged 1 commit into
agent/43-disk-activityfrom
agent/44-docker-status
Sep 28, 2026
Merged

nabil1440 merged 1 commit into
agent/43-disk-activityfrom
agent/44-docker-status

Conversation

@nabil1440

@nabil1440 nabil1440 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

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 of cpuN lines in /proc/stat.
  • New package internal/dockerapi. A client for the Docker Engine API on the unix socket, with the Go standard library only. It sends only GET /version and GET /containers/json, with a limit of 5 seconds for each request. It does not use the docker command.
  • status.docker_status, in the order of the contract:
    • running when GET /version answers
    • not_running when there is no socket, or the connection is refused, and /usr/bin/dockerd exists
    • not_installed in the same case without /usr/bin/dockerd
    • null for each other result, for example "permission denied" or no answer in 5 seconds. The agent writes one warning.
  • status.docker_version: the Version of the answer, only when docker_status is running.
  • The agent keeps each value in its range: cpu_count 1 to 4096, a known docker_status, and a docker_version of at most 32 characters.

Caution

  • Access to the Docker socket is root access. The agent user already has it on a FlyWP server. The agent sends only the two requests above, and a test examines this.

Tests

  • A fake Docker Engine on a unix socket: running, no socket with and without dockerd, a refused connection, a socket that refuses the user, and no answer.
  • make check passes.

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
nabil1440 force-pushed the agent/44-docker-status branch from f008dd0 to bf7119d Compare September 24, 2026 08:14
@nabil1440
nabil1440 merged commit edb9881 into develop Sep 28, 2026
1 of 2 checks passed
@nabil1440
nabil1440 deleted the agent/44-docker-status branch September 28, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Send the CPU count and the Docker state in the status

1 participant