Skip to main content

noc-ops —— 多云运维 ops CLI

noc-ops is a multi-cloud ops CLI for AWS, Alibaba Cloud, Tencent Cloud, Volcengine, Google Cloud, Azure, Oracle Cloud, plus Cloudflare DNS (read-only) and Supabase (read, plus pause/resume of projects). It keeps one inventory across all your accounts, serves a local NOC dashboard, generates your SSH config, and reboots instances through a single command. You drive it in natural language from any shell-capable agent client (Claude Code, Codex, Cursor, Gemini CLI, Kiro, Cline …) via the companion skill pholex/multicloud-ops; the model comes from your client, the core package has zero runtime dependencies. macOS (primary) and Linux; Windows is not supported. Python ≥ 3.10, Apache-2.0.

uv tool install noc-ops && ops setup && ops init && ops doctor --fix && ops sync && ops noc

Documentation is in Chinese below; the skill, ops help and ops doctor are enough to get going in English.

把散落在九朵云、十几个账号里的机器、域名、数据库、函数、成本收进一份清单、一张看板、一个重启入口,然后用自然语言驾驭它们。

  • 一份清单:ops sync 扫全部账号,生成人读的 inventory.md、机读的 data.json,顺手把能 SSH 的机器写进 ~/.ssh/config。
  • 一张看板:ops noc 在本机起一个密集表格看板,十四个标签页覆盖实例到操作日志。
  • 一个重启入口:ops reboot <名字> 不管这台机器在哪朵云、还是在机房的 VMware / 深信服 HCI 上。
  • 自然语言入口:装一份 skill 到你已有的 agent 客户端里,直接说「东京有几台 EC2 在运行」。写操作先回显再确认,重启免确认,全部进审计日志。
  • 能力会长:做过的运维存成 runbook,下次 agent 照着做。加能力 ≈ 写一个 markdown。

核心只用 Python 标准库,不绑任何一家模型厂商。

平台:macOS 为主要开发与日常使用平台,Linux 经全新安装测试可用;不支持 Windows(WSL 未验证)。

支持范围

云 实例 域名 数据库 存储 函数 CDN IAM AI 密钥 消息·事件 成本 额度 重启
AWS ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
阿里云 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
腾讯云 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
火山引擎 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Google Cloud ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Azure ✓ ✓ ✓ ✓ ✓ ✓ ✓
Oracle Cloud ✓ ✓ ✓ ✓ ✓ ✓ ✓
Cloudflare ✓ 只读 ✓ ✓ ✓
Supabase ✓ ✓ ✓ 暂停/恢复
内网虚拟化平台:VMware / 深信服 HCI ✓ ✓
内网其它主机:群晖、任何能 SSH 的物理机或虚机 ✓
  • 内网机器两种接入:vCenter / 深信服有管控 API,自动扫出虚机并可重启(深信服暂只能查状态);其它机器不分物理还是虚拟,在工作区 local-servers.toml 登记一行即可,ops sync --local 探 SSH 端口判断在线。人不在内网时,Tailscale 组网上的机器用 ops sync --tailscale 刷。
  • Cloudflare 每个 zone 带状态、DNS 记录数与代理数、SSL 模式、套餐、NS;在 Cloudflare Registrar 注册的域名还有到期日,和其它注册商同一列。另:R2 桶进存储、Workers 脚本进函数、开了代理记录的 zone 进 CDN(和 CloudFront 并排)。只读,不做任何写操作。
  • Supabase 每个项目带算力档位(vCPU / 内存)、库实际占用、PITR 与最近备份、网络访问限制是否收紧、是否挂自定义域名。Storage 桶进存储(公开桶标 ⚠)、Edge Functions 进函数。唯一的写操作是 ops db pause|resume 暂停 / 恢复项目,可逆,先回显计划再确认;不删项目、不改配置。
  • 「AI 密钥」只盘元数据(绑定的 API、服务账号、创建时间),永远不取密钥串。
  • 「额度」指信用余额、免费额度到期、超额保护,渲染在 inventory.md,不单独开 tab。
  • 定时重启(看板「计划任务」)用一个 AWS 账号里的 EventBridge + Lambda 做调度器,可以派发到其它云的实例。
  • 深信服 HCI 目前只能查状态,这版管控 API 不认重启端点,命令会如实告诉你改走哪条路。
  • 云 CLI 用到哪朵装哪朵,没装的云 ops sync 自动跳过。火山引擎的 TOS 桶和腾讯云的 COS 桶不在各自 CLI 里,分别另装官方 tosutil(tosutil config -interactive)和 coscli(coscli config init)配好即可纳管。

三分钟上手

uv tool install noc-ops        # 或 pipx install noc-ops
ops setup                      # 记工作区位置,把 skill 扇出到本机所有 agent 客户端
ops init                       # 交互式生成配置:发现你的账号 / 区域 / SSH key
ops doctor --fix               # 体检云 CLI、凭证、工作区、客户端;能自动修的修掉
ops sync                       # 首次扫云,生成清单与 SSH 配置
ops noc                        # 打开看板 http://127.0.0.1:8765

前置依赖(Python ≥ 3.10、uv、各云 CLI 与凭证的配置方法)、分步说明和常见问题见 INSTALL.md。升级用 uv tool upgrade noc-ops,工作区数据不丢。

日常怎么用

ops setup 装好 skill 之后,在 Claude Code、Codex、Cursor 等客户端里直接说话:

  • 「宁夏有几台 EC2 在运行」
  • 「重启 web-01」
  • 「哪些域名的证书 30 天内到期」
  • 「上个月各云分别花了多少」
  • 「把 db-02 的磁盘使用率看一下」
  • 「新加了一台机器,同步一下清单」

agent 会查 data.json 定位目标,直调对应云的 CLI 或 SSH,写操作先把计划回显给你确认。匹配到多台同名机器时它会列出来让你挑,不会猜。

没有 shell 的 GUI 客户端(如 Claude Desktop)用 MCP 接入:uv tool install --force 'noc-ops[mcp]' 后 ops setup --with-mcp。

看板 ops noc

本地服务,ag-Grid 密集表格,按账号 / 区域 / 状态筛选,关键字搜索,列宽拖拽,导出 CSV,主题跟随系统明暗。十四个标签页:

实例 · 域名 · 数据库 · 对象存储 · 函数 · CDN · IAM · AI 密钥 · 消息/事件 · 成本 · 计划任务 · 剧本 · 操作日志 · 纳管范围

每页旁边的刷新图标只重扫当前这一类资源;右上「刷新」做一次完整 ops sync。默认后台守护启动,关终端不死:

ops noc                     # 后台启动并打开浏览器
ops noc status | stop | restart
ops noc -f --port 9000      # 前台跑、换端口(调试用)

看板的 JS 与字体随包自带,运行期不访问任何第三方 CDN,数据只在本机。

命令速查

命令 作用
ops sync 全量扫云:对比快照,报告新增 / 变更 / 删除,重写清单与 SSH 配置
ops sync --kind=instances 只刷一类资源(instances / domains / databases / storage / serverless / cdn / iam / apikeys / messaging / billing / credits)
ops sync --account=<账号> 只刷一个云账号,AWS 用账号 ID,阿里云用 profile 名;可与 --kind 组合
ops sync --local / --tailscale 单刷内网 / Tailscale 组网上的机器,它们不参与全量扫描,连不上不会被误判为已删除
ops sync --probe=<实例> 只探一台机器的 SSH 登录用户名并回写配置,不触云
ops reboot <名字或 ID> 重启;--status 只查状态,--dry-run 只打印将执行的命令
ops db status|pause|resume <名字或 ref> 托管数据库项目查状态 / 暂停 / 恢复(目前仅 Supabase);暂停与恢复先回显再确认,--yes 跳过交互
ops netprobe 探测本机出口链路:接口、按目标分别探出口 IP 与归属,纯只读
ops doctor [--fix] 体检;每个未通过项给出确切的下一步命令
ops setup [--workspace DIR] [--with-mcp] 装 / 刷新 skill;指定工作区;可选接 MCP
ops log <action> [target] 手工记一条操作日志
ops help 完整用法,末尾列出已安装的扩展

安全模型

操作类型 行为
只读(describe / list / get、状态查询) 自动执行,不打扰
实例重启 直接执行,低风险可逆,自动记审计日志
其它写操作(启停 / 暂停恢复 / 销毁 / 改配置、远程改动、删资源) 先回显计划,等你确认才做

拿不准的一律按写操作对待。所有写操作记入 <工作区>/.state/ops-log.jsonl,看板「操作日志」页可看。凭证只住在各云 CLI 自己的配置和系统 Keychain 里,ops 不保存、不上传。

工作区

代码装在 venv 里只读;你的数据全部在工作区,默认 ~/.noc,用 NOC_HOME 或 ops setup --workspace 改:

<workspace>/
├── ops-config.toml   # 你的账号、区域、SSH key 约定(ops init 生成)
├── inventory.md      # 人读清单,含云账务 / 额度一节
├── data.json         # 机读数据,看板与 skill 读它
├── runbooks/*.md     # 你沉淀的运维剧本
└── .state/           # 运行时状态:SSH 用户缓存、快照、操作日志、看板日志

升级 noc-ops 不碰工作区。秘密(API token、密码)不要写进 ops-config.toml,放系统 Keychain 或环境变量,配置文件里只留引用。

沉淀 runbook

  1. 在 agent 客户端里把一件运维做完。
  2. 让它「存成 runbook」,它会按 runbooks/_TEMPLATE.md 写一份,标注触发意图与是否写操作。
  3. 下次同类需求,agent 会先找到这份剧本照着执行。

看板「剧本」页列出全部剧本,点名字直接看正文。

扩展与贡献

  • 团队专属的子命令、skill 规则、终端内自然语言入口,可以放在自己的私有包里,经 entry point 挂回 ops,公开包不需要改。写法见 CONTRIBUTING.md。
  • 改本仓代码、跑测试、新增一朵云的清单,也在 CONTRIBUTING.md。

许可

Apache License 2.0,见 LICENSE 与 NOTICE。看板自带的 AG Grid Community 与 Inter 字体各随其原许可(MIT / OFL 1.1)。

Metadata

Release files for noc-ops 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for noc-ops 0.1.9
File Interpreter ABI Platform
noc_ops-0.1.9-py3-none-any.whl Python 3 none any Details

Release files / noc_ops-0.1.9-py3-none-any.whl

Download URL noc_ops-0.1.9-py3-none-any.whl
Size 798.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e05cddcf6e51ecc58cfff358dc74f9fe20ba03f5715c7d48cf36e34e18d5afcc
BLAKE2b-256 checksum
How to use checksums
700c1d2fe7cacd02feeafb2fc8d16443ac5bf42223be9e9c9988ad1874c37cc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for noc-ops 0.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page