====== 第十五章:Shell接口 for the Proxmox VE API ====== 原文链接:https://pve.proxmox.com/pve-docs/chapter-pvesh.html 最后更新:2026-02-25 ===== 概述 ===== pvesh是Proxmox VE的Shell接口,用于与Proxmox VE API交互。它是一个命令行工具,允许用户直接在shell中执行API调用。 ===== 使用方法 ===== pvesh [OPTIONS] ===== 常用命令 ===== === 列出所有节点 === pvesh get /nodes === 获取节点状态 === pvesh get /nodes/{node}/status === 列出虚拟机 === pvesh get /cluster/resources === 访问日志 === pvesh get /nodes/{node}/syslog ===== 认证 ===== pvesh使用与Proxmox VE API相同的认证机制。您可以使用以下方式认证: * 用户名和密码 * API令牌 ===== 选项 ==== * ''-h'', ''--help'' - 显示帮助信息 * ''--output-format json'' - 以JSON格式输出 * ''--quiet'' - 安静模式 ===== 示例 ===== === 创建虚拟机 === pvesh create /nodes/{node}/qemu -vmid 100 -name test-vm -ostype l26 === 启动虚拟机 === pvesh create /nodes/{node}/qemu/100/status/start === 停止虚拟机 === pvesh create /nodes/{node}/qemu/100/status/stop ===== 注意事项 ===== * pvesh是一个强大的工具,可以执行几乎所有可以通过Web界面或API执行的操作 * 使用时请小心,因为某些操作可能会导致数据丢失 * 建议在使用前先了解相应的API文档