CloudMonkey (cmk) Skill
You have access to cmk, the Apache CloudStack CLI. Use it to manage CloudStack infrastructure by running shell commands via the exec tool.
Basic usage
CODEBLOCK0
Examples:
- -
cmk list virtualmachines — list all VMs - INLINECODE2 — filter by state
- INLINECODE3 — start a VM
- INLINECODE4 — stop a VM
- INLINECODE5 — destroy a VM
- INLINECODE6 — list availability zones
- INLINECODE7 — list templates
- INLINECODE8 — list storage volumes
- INLINECODE9 — snapshot a volume
- INLINECODE10 — list networks
- INLINECODE11 — list public IPs
Profiles
CloudMonkey supports multiple profiles (e.g. for different CloudStack environments).
- -
cmk set profile <name> — switch profile - INLINECODE13 — list configured profiles
- Config is stored in INLINECODE14
Output format
- -
cmk set display json — switch to JSON output - INLINECODE16 — switch to table output (default)
- INLINECODE17 — plain text
Tips
- - Always confirm destructive operations (destroy, expunge) with the user before running.
- Use
cmk list apis to discover all available CloudStack API commands. - UUIDs are required for most operations — use list commands first to find them.
- Filter results using key=value pairs after the command (e.g.
name=myvm)
CloudMonkey (cmk) 技能
你可以使用 cmk(Apache CloudStack 命令行界面)。通过 exec 工具运行 shell 命令来管理 CloudStack 基础设施。
基本用法
cmk <动词> <名词> [参数]
示例:
- - cmk list virtualmachines — 列出所有虚拟机
- cmk list virtualmachines state=Running — 按状态过滤
- cmk start virtualmachine id= — 启动虚拟机
- cmk stop virtualmachine id= — 停止虚拟机
- cmk destroy virtualmachine id= — 销毁虚拟机
- cmk list zones — 列出可用区
- cmk list templates templatefilter=featured — 列出模板
- cmk list volumes — 列出存储卷
- cmk create snapshot volumeid= — 创建卷快照
- cmk list networks — 列出网络
- cmk list publicipaddresses — 列出公网 IP
配置文件
CloudMonkey 支持多个配置文件(例如用于不同的 CloudStack 环境)。
- - cmk set profile <名称> — 切换配置文件
- cmk list profiles — 列出已配置的配置文件
- 配置存储在 ~/.cmk/config 中
输出格式
- - cmk set display json — 切换为 JSON 输出
- cmk set display table — 切换为表格输出(默认)
- cmk set display text — 纯文本输出
提示
- - 在执行破坏性操作(销毁、清除)前,务必先与用户确认。
- 使用 cmk list apis 发现所有可用的 CloudStack API 命令。
- 大多数操作需要 UUID — 先使用 list 命令查找它们。
- 在命令后使用 key=value 对过滤结果(例如 name=myvm)。