KNetraHub node agent: per-node CPU, memory, disk and container usage for the portal.
669
Lightweight per-node metrics collector for KNetraHubā .
The KNetraHub app only has direct Docker API access to the node it runs on. This agent closes that gap: deployed as a global swarm service (one task per node, managers included), it reports each node's live CPU, memory, disk, and per-container usage back to the app over HTTP ā so the dashboard sees the whole cluster without exposing the Docker API over TCP.
š Documentation: https://sengphirum.github.io/KNetraHub/documentationā
:ro and only ever POSTs reports outward.KNETRAHUB_AGENT_MODE.latest ā most recent releasex.y.z (e.g. 0.1.11) ā immutable release versions; keep the tag in sync with your
phirumseng/knetrahub-app versionAdd the agent to the same stack as the KNetraHub app (excerpt):
services:
agent:
image: phirumseng/knetrahub-agent:latest
environment:
KNETRAHUB_AGENT_URL: "http://knetrahub_app:3000/api/agent/report"
# Must equal the app service's NUXT_AGENT_TOKEN
KNETRAHUB_AGENT_TOKEN: "change-me-to-a-long-random-string"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
deploy:
mode: global # one task on every node
resources:
limits:
cpus: "0.10"
memory: 64M
For production, use a Docker secret instead of a plaintext token:
secrets:
- knetrahub_agent_token
environment:
KNETRAHUB_AGENT_TOKEN_FILE: "/run/secrets/knetrahub_agent_token"
(The image is distroless; _FILE resolution happens inside the process, so file-based
secrets work without a shell entrypoint.)
| Variable | Default | Purpose |
|---|---|---|
KNETRAHUB_AGENT_URL | ā (required) | The app's report endpoint, e.g. http://knetrahub_app:3000/api/agent/report. |
KNETRAHUB_AGENT_TOKEN | ā (required) | Shared secret; must equal the app's NUXT_AGENT_TOKEN. Also accepts KNETRAHUB_AGENT_TOKEN_FILE. |
KNETRAHUB_AGENT_MODE | docker | Comma-separated collectors to run: docker, server, network, asset. |
KNETRAHUB_AGENT_INTERVAL_MS | 15000 | Report interval. |
KNETRAHUB_AGENT_DF_INTERVAL_MS | 600000 | Disk-usage (docker system df) sampling interval. |
KNETRAHUB_AGENT_STATS_CONCURRENCY | 4 | Parallel container stat reads per cycle. |
DOCKER_SOCKET_PATH | /var/run/docker.sock | Docker Engine socket to read from. |
| Mode | What it collects |
|---|---|
docker | Node CPU/memory/disk and per-container usage for the Docker dashboard (default). |
server | Host metrics for the Monitoring module's server monitoring. |
network | Network device metrics for the Monitoring module. |
asset | Hardware/asset inventory reporting. |
Proprietary ā Ā© Seng Phirum. All rights reserved.
Content type
Image
Digest
sha256:2021af7bdā¦
Size
51.6 MB
Last updated
15 days ago
docker pull phirumseng/knetrahub-agent