maand collect
collect probes workers listed in workspace/workers.json over SSH. By default subcommands print a human-readable summary; collect facts --generate-workers prints updated workers.json content for redirection.
CLI
maand collect facts [flags]
maand collect uptime [flags]
| Flag | Description |
|---|---|
--workers |
-w |
--labels |
-l |
--concurrency |
-c |
--ignore-failure |
|
--generate-workers |
Examples:
maand collect facts
maand collect facts --generate-workers > workspace/workers.json
maand collect facts --generate-workers -w 10.0.0.1,10.0.0.2 -c 2
maand collect uptime -w 10.0.0.1,10.0.0.2 -c 2
maand collect uptime --ignore-failure
Subcommands
maand collect facts
Prints discovered memory and cpu for each worker:
10.0.0.1 memory="8192 mb" cpu="2400 mhz"
Memory comes from /proc/meminfo (MemTotal). CPU is logical cores × per-core MHz from /proc/cpuinfo or lscpu.
With --generate-workers, stdout is valid workers.json: the current file with probed memory / cpu merged in (other fields preserved). Redirect to update the workspace file:
maand collect facts --generate-workers > workspace/workers.json
maand build
With -w / -l, only matching workers are probed; the printed JSON still includes all workers from the current file (unprobed entries unchanged).
With --generate-workers and --ignore-failure, successful probes are merged into the printed JSON; failures go to stderr and the exit code is 1.
maand collect uptime
Prints host uptime for each worker as each probe completes (completion order, not workers.json order):
10.0.0.1 uptime="up 3 days, 4 hours, 12 minutes"
Prerequisites
- Initialized bucket with worker
hostentries inworkspace/workers.json. - SSH key at
secrets/<ssh_key>(frommaand.conf) authorized on workers. - Host tools:
bash,ssh(checked before SSH). - Target workers: Linux with
/proc/meminfo(facts),bash, andtimeout(sudowhenuse_sudo = true).
Unlike maand run_command, maand collect does not require a prior maand build.
Failure behavior
By default, if any worker probe fails, no output is printed and the command exits with code 1.
With --ignore-failure:
- Successful workers are printed to stdout as each probe finishes.
- Failures are summarized on stderr after all probes complete.
- Exit code is 0 only when all workers succeed; otherwise 1.
Example:
maand collect uptime --ignore-failure
# stdout:
10.0.0.1 uptime="up 3 days, 4 hours, 12 minutes"
# stderr:
worker uptime failures (1):
worker 10.0.0.2: ssh: connect to host 10.0.0.2 port 22: Connection refused
# exit code: 1
If every worker fails, there is no stdout output; stderr lists all failures and the exit code is 1.