Running Commands
Maand enables executing Linux commands across all workers seamlessly.
Commands
Commands are added to the command.sh
file in the workspace
folder.
Example Folder Structure
.
├── data
│ └── maand.db
├── logs
│ └── maand.log
├── maand.conf
├── secrets
│ ├── ca.crt
│ └── ca.key
│ └── worker.key
└── workspace
├── workers.json
├── command.sh <==============================
└── maand.jobs.conf
Define Commands
- Open the
workspace/command.sh
file. - Add the desired command(s).
Example: Disk Usage Check
$ cat workspace/command.sh
df -h
Build Workspace
Compile the changes: use build command always whenever changes made to workspace folder.
$ maand build
Execute Commands
Run the script across all worker:
$ maand run_command
Sample Output
Results are displayed per agent:
[10.27.221.144] Filesystem Size Used Avail Use% Mounted on
[10.27.221.144] /dev/mapper/fedora_agent2-root 15G 9.9G 5.1G 66% /
[10.27.221.170] Filesystem Size Used Avail Use% Mounted on
[10.27.221.170] /dev/mapper/fedora_agent3-root 15G 9.8G 5.2G 66% /
[10.27.221.181] Filesystem Size Used Avail Use% Mounted on
[10.27.221.181] /dev/mapper/fedora_fedora-root 15G 11G 4.5G 71% /
Logs
Command results are saved in the logs
directory for each worker.
Example:
$ tree logs
logs
├── 10.27.221.144.log
├── 10.27.221.170.log
└── 10.27.221.181.log
Log Content:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora_agent2-root 15G 9.9G 5.1G 66% /
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm