Command Line Interface(Cloudmonkey)
CloudMonkey (cmk) is the official, high-performance command-line interface (CLI) for Zergaw CloudStack. cmk provides a fast, standalone binary capable of managing your IaaS environments.
Key Capabilities
- Dynamic API Schema Discovery: Fetches and caches server API specifications live via the
synccommand, automatically supporting custom API extensions, plugin commands, and new CloudStack releases without binary updates. - Interactive REPL Shell: Features auto-completion (Tab-completion) for commands, options, and parameters, with inline documentation lookup.
- Flexible Output Formats: Supports
json,yaml,table,csv,text, and customizable custom column displays. - Asynchronous Job Management: Automatically polls long-running CloudStack operations (e.g., VM deployments, volume snapshots) with configurable blocking behavior (
asyncblock). - Pipeline & Automation Ready: Accepts commands from standard input (
stdin), terminal flags, or shell scripts with native UNIX pipe integration.
Installation & Setup
cmk is distributed as a single static binary for Linux, macOS, and Windows.
Linux (x86_64 / ARM64)
# Download latest Linux release
curl -L -o cmk https://fms.zergaw.com/index.php/s/p5k94DfTwT39kRE/download/cmk.linux.x86-64
# Grant execution permissions
chmod +x cmk
# Move to system path
sudo mv cmk /usr/local/bin/
# Verify installation
cmk version
macOS (Apple Silicon)
# macOS (ARM64 / M-series)
curl -L -o cmk https://fms.zergaw.com/index.php/s/ZajSRydCcHfmD34/download/cmk.darwin.arm64
chmod +x cmk
sudo mv cmk /usr/local/bin/
Windows (PowerShell)
Invoke-WebRequest -Uri "https://fms.zergaw.com/index.php/s/AjbRE9sTeyeo8RM/download/cmk.windows.x86-64.exe" -OutFile "cmk.exe"
Move-Item cmk.exe C:\Windows\System32\
Configuration & Authentication
Launch cmk without parameters to start the interactive shell:
cmk
To set up username/password authentication:
cmk > set url https://cloudstack.zergaw.com/client/api
cmk > set username USERNAME
cmk > set password PASSWORD
cmk > set domain DOMAIN
Before using auto-completion or querying new API endpoints, synchronize the local API cache with your CloudStack management server:
cmk > sync
Operating Modes
Interactive REPL Mode
Running cmk enters interactive mode.
$ cmk
🦧 Apache CloudStack 🐵 CloudMonkey 6.5.0
Type "help" for help, "how-to" for tips, "ctrl-c" or "exit" to exit.
Interactive Shell Shortcuts:
Tab: Auto-completes commands, subcommands, and parameter keys.Ctrl + C: Cancels current line or interrupts execution.Ctrl + Dorexit: Exits the CloudMonkey shell.help: Displays general help or specific command syntax.
Direct CLI / One-Shot Mode
Execute single commands directly from your terminal or shell scripts:
cmk list virtualmachines state=Running
Output Formatting & Data Filtering
CloudMonkey provides multiple output formats to simplify both human reading and automated parsing.
| Format | Option Keyword | Primary Use Case |
|---|---|---|
| Table | table |
Human interactive reading (default) |
| JSON | json |
Automation, piping to jq |
| YAML | yaml |
Configuration manifests, readability |
| CSV | csv |
Exporting reports to spreadsheets |
| Text | text |
Simple scalar key-value listings |
Quick Cloud Setup through cmk
- Create a network
(localcloud) cmk > create network zoneid=8de6d4e2-e032-4dce-b09b-468b69a8c398 name=demo-net displaytext=demo-net networkofferingid=8c784ca2-9f95-4b9a-9acd-515a4e04595f gateway=10.0.10.1 netmask=255.255.255.0 dns1=1.1.1.1 dns2=8.8.8.8 account=demo.admin domainid=e97a2cde-61a1-4f31-8c6c-8415860fcb99
- Create an instance on the network
(localcloud) cmk > deploy virtualmachine zoneid=8de6d4e2-e032-4dce-b09b-468b69a8c398 boottype=BIOS bootmode=LEGACY templateid=14db197e-8c84-418b-9800-50d2e55350a3 rootdisksize=30 startvm=true serviceofferingid=d26af6a7-cde4-46ab-b3fc-e99b9d94d6e3 iptonetworklist[0].networkid=6c87e9dd-f37f-473d-83a3-ff638b9cd1ce name=demo-vm displayname=demo-vm account=demo.admin domainid=e97a2cde-61a1-4f31-8c6c-8415860fcb99
Don't forget to copy the password from the field password on the JSON response
Troubleshooting & FAQ
Issue 1: cmk: command not found
- Cause: Binary is not in system execution path (
PATH). - Fix: Ensure binary is moved to
/usr/local/bin/or added to$PATH.
Issue 2: HTTP 401 Unauthorized / Invalid Credentials
- Cause: Incorrect Username/Password pairing, invalid timestamp/signature, or revoked user keys.
- Fix:
- Regenerate Username/Password in Zergaw CloudStack Web UI (Accounts -> Users -> User Details).
- Verify clock synchronization on local computer (
ntpdateorchrony). Signature generation relies on accurate UTC timestamps.
Issue 3: Missing Autocompletions or New API Parameters
- Cause: Local schema cache is out of sync with server.
- Fix: Run
synccommand inside interactivecmkshell.