Margrop
Articles277
Tags715
Categories6

Categories

1password 24GB VRAM 2K 3.6 Flash 30B dense 4-bit 量化 6-DoF SLAM AC ACP AI & Economy ATLAS AI Agent AI Coding Assistant AI Tech AI Workflow AI tutor AI 基础设施 AI 安全 AI 工程 AI 应用 AI 日记 AI 生产力 AI编程助手 ALTK-Evolve AMIE AP API API 定价 API 降价 ARC-AGI-3 ASR ATEM chat 模板 AUTOMATIC1111 Agent Agent Harness Agent Memory Agent 入侵 Agent 可靠性 Agent 工程 Agent 架构 Agent 检索 Agent 沙箱 Agent 系统 Agent 训练 Agent 记忆 Agent 评测 Agent 路由 Agentic AI Agentic tools Ai2 Alertmanager AllenAI Android 17 Antigravity AppDaemon AppWorld Aqara Astra Async GRPO Attention AutoSynthData Baseten Benchmark CC-Switch CI/CD CLI Tools CLI工具 CPU 推理 Cache Hit Rate Caddy ChatGPT Claude Code Claude Sonnet ClawLoader Code Interpreter CodeMender Codex Coding Agent ComfyUI Computer Use Cookie 认证 Cosmos-H-Dreams Cost Optimization Cron Cybersecurity DFIR DSpark Date DeepSeek DeepSeek V4 Flash Diagrams.net Diary Diffusers Diffusion Docker Efficiency Tools Embedding English Evaluation Cards FSDP2 Fable 5 Fireworks AI FlashAttention FlashDreams Frontier AI Function Calling Funes GGUF GLM 5.2 GLM-5.2 GPT-4.1 GPT-5.6 GPT-5.6 Sol GPT-6 GPT-Live GPT-Live-1 GPT-Red GPU 加速 GPU 性能分析 GRPO Gateway Gemini Gemini 3.5 Flash Gemini 3.7 Flash Gemini 3.8 Gemini 4 Argon Gemini API Gemini CLI Gemini Omni Flash Gemma 4 12B Gemma Translator Gemma4 GitHub Actions Google Google AI Google Beam Google Data Commons Google DeepMind Google Research Google Sheets Grabette Gradio Gradio Workflow Gripette HA HADashboard HF Security Incident Hailuo Hermes Hexo Holo4 HomeAssistant Hugging Face IBM Granite IBM Research In-context Learning Inference Providers Isaac Lab JSON Output Java KV cache Kimi K3 Kubernetes LFM2.5 LFM2.5-VL LLM Router LLM 安全 LLM 工程 LLM 评测 LVM‑Thin Late Interaction LeRobot Linux Liquid AI LiquidAI Live Translate LoRA Luna MCP MTP MacOS Magpie TTS Managed Agents Meta Microsoft 365 Copilot MiniMax Mistral Shieldstral Model Routing MuJoCo Warp Multi-Agent Multi-Vector Muse Glimmer MySQL NAS NIM NVIDIA NeMo Automodel Nemotron 3 Embed NeoMME Newton Nginx Node.js Nunchaku OCR OOM OlmoEarth On-device AI Open Source OpenAI OpenAI Codex OpenAI 兼容 OpenClaw OpenCode OpenResty OpenWrt PII 检测 Physical AI Pollen Robotics Portainer PostgreSQL ProcessOn Project Astra Prometheus Prompt Caching Prompt Injection Prompt 缓存 Proxmox VE PyTorch Qwen3 Qwen3-VL Qwen3.6 RAG RPC RTEB Real-Time Inference Red Teaming Responses API SNAP SOCKS5 SPED SVDQuant Schema Scientific Computing Self-Forcing Distillation Sentence Transformers Session Sheets canvas Shell Sol Storage Buckets Strands Agents Subagent Surgical Robotics TRL TTS Tabular Terra Think button TimeMachine Tokenizer Transformers TutorMoments UML Uptime Kuma V4-Pro VPS Voice Agent VoiceEQ WARP WebRTC WebSocket Windows World Foundation Model agent agentic aligenie aliyun annotation aop autofs backup bash bitwarden boot brew browser budget control centos cert certbot charles chat chrome classloader client clone closures cloudflare command commit commoditization container crontab cyber capability demo dependency deploy developer devtools dll dns docker domain download drafter draw drawio dsm dump dylib environment hooks exception fail2ban feign firewall-cmd flow free tier frontier hosted model frp frpc frps fuckgfw full-duplex function gfw git github gperftools gridea grub guardrail lockout gvt-g hacs havcs heap hello hexo hibernate hidpi hoisting homeassistant hosts html htmlparser https huggingface_hub iKuai iMessage image img img2kvm immortalwrt import index inference cost install intel io ios ip iptables iso java javascript jni jnilib jpa js json jsonb jupter jupyterlab jvm k8s kernel key kvm lastpass launchctl learning letsencrypt linux llama.cpp low-code lvm mac mariadb markdown maven md5 microcode mirror modules monitor mount mstsc multimodal mysql n5105 network nfs node node-red nodejs nohup notepad++ npm nssm ntp oop open weights openfeign openssl os ovz packet capture pdf pem perf pip plugin png powerbutton print pro productive struggle pve pvekclean python qcow2 qemu qemu-guest-agent rar reasoning control reasoning slider reboot reflog remote remote desktop renew repo resize retina router runtime safari sata scaffolding scheduled triggers scipy-notebook scoping scp self-play server serverless inference silent test simulated student so speculative decoding spk spring springboot springfox ssh ssl stash string support svg svn swagger sync synology systemctl systemd template terminal txt ubuntu ui undertow unlocker upgrade vLLM vhd vim vm vmdk web windows with worker xml yum zai-org/GLM-5.2 zip 一致性评测 上下文压缩 上下文工程 交换机 人才争夺 人机协作 代理 企业 AI 企业自动化 优化 低延迟 供应链 健康检查 光猫 免费层 内存 内存优化 内网渗透 分布式推理 分布式训练 医疗 AI 升级 卫星影像 反向代理 反诉 可复现性 合成数据 向量检索 启动 告警 告警优化 图像生成 地球观测 地理空间推理 复盘评测 夏令时 多 token 预测 多向量检索 多智能体 多模型编排 多模态 多模态 AI 多模态 API 多模态 Agent 多模态交互 多模态检索 多语言 多语言 AI 大厂人才战 大模型评测 天猫精灵 安全 安全事件 安全对齐 安全评测 安装 定时任务 实时协作 实时语音 客户端 SDK 容器 导入 小米 屏幕理解 工作流编排 工具审计 工具调用 工具调用拦截 工程团队 工程实践 工程笔记 常用软件 应用市场 延迟优化 开权重 开源权重 开源模型 异常 异步任务 异步委派 强化学习 微信 心跳 性能优化 性能捕捉 成本优化 成本控制 扩散模型 技术 抓包 拒答校准 按 provider 优先级 排查 推测解码 推理加速 推理成本 推理速度 推理预算 描述文件 提示词敏感性 故障排查 效率工具 教育数据开源 教育评测 数据工作流 数据治理 数据流 数据集偏差 文本编码器 旁路由 日志分析 日记 时区 显卡虚拟化 智能家居 智能音箱 服务管理 本地 agent 本地推理 机器人仿真 机器人学习 机器人数据采集 架构 模块 模型推理 模型评测 模型路由 残存访问 流式推理 流程 流程图 浏览器 混合专家 漫游 火绒 生成式影像 电信 画图 监控 监控系统 监管 知识蒸馏 磁盘 科研自动化 稀疏注意力 立体声 端侧 AI 端侧推理 端口 端口冲突 端口扫描 结构化输出 续期 网关 网络 网络安全 网络风暴 群晖 脚本 脚本优化 腾讯 自动化 自动恢复 自动攻击 自部署 苹果 虚拟机 表格基础模型 视觉语言模型 视频生成 视频问诊 认证 证书 评测 评测基准 评测方法学 诉讼 语音 AI 语音 Agent 语音识别 超时 路由 路由器 软件工程 软件管家 软路由 运维 运维监控 连接保活 连接问题 通信机制 通知 邮件漏发 部署 配置 量化 量子计算 钉钉 镜像 镜像源 长上下文 长任务编排 长连接 门窗传感器 问题排查 防火墙 阿里云 阿里源 集客 飞书

Hitokoto

Archive

PVE 磁盘巡检接入 Uptime Kuma——踩坑 404 的来龙去脉与最终脚本

PVE 磁盘巡检接入 Uptime Kuma——踩坑 404 的来龙去脉与最终脚本

写在前面
前一篇文章教大家把 PVE 宿主机的 LVM‑Thin 用量推到 Uptime Kuma。
有同学照做后 curl 推送却报 404。本文完整复盘原因、修正脚本,并给出 可选升级方案。零基础跟着做,保证一次成功。


1 现象:curl … 404

1
2
3
4
5
curl -fsS --retry 3 \
"${PUSH_URL}?status=up&msg=OK" \
-H 'Content-Type: application/json' \
--data-raw "$result"
# ↳ curl: (22) The requested URL returned error: 404

同一条 URL 用浏览器或 curl GET 又能收到:

1
{"ok":true}

2 原因:旧版 Uptime Kuma 只支持 GET/HEAD Push

一旦 curl 带 --data-raw/-d,HTTP 方法就变 POST,而 Kuma ≤ 1.23.x 的 Push 路由只注册了 GET/HEAD,因此直接 404。社区里已有多人反馈同样问题,GitHub Issue #3267 被标记为「feature‑request」至今未合并。(GitHub)

Reddit 4 个月前的讨论同样验证了“POST 会 404,暂无官方解决方案”。(Reddit)


3 两条出路

方案

思路

适用场景

A. 改回纯 GET

不带正文,用 URL 参数(最稳妥)

不想折腾 Kuma 升级

B. 升级到 2.x β 版 / 自行打补丁

未来版本预期会支持 POST;也可用反向代理把 POST 转 GET

愿意测试新版本、或必须上传大量 JSON 正文

下文主讲 方案 A,保证 5 分钟之内搞定。方案 B 放在文末扩展阅读。


4 最终脚本(纯 GET 版)

4.1 配置文件不变

1
2
# /etc/lvm_check.conf
PUSH_URL="http://192.168.102.146:3001/api/push/E94XDnl557"

4.2 推送脚本 /usr/local/bin/lvm_kuma_push.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
# 向 Uptime Kuma 发送 GET 心跳,兼容旧版不支持 POST 的限制
source /etc/lvm_check.conf
[ -z "$PUSH_URL" ] && { echo "缺少 PUSH_URL"; exit 1; }

json="$(/usr/local/bin/lvm_check.sh)"
status=$(echo "$json" | jq -r '.status')
encoded_json=$(printf '%s' "$json" | jq -sRr @uri) # URL‑encode 详情

if [ "$status" = "ok" ]; then
curl -fsS --retry 3 \
"${PUSH_URL}?status=up&msg=OK&details=${encoded_json}"
else
problem=$(echo "$json" | jq -c '.volumes')
encoded_prob=$(printf '%s' "$problem" | jq -sRr @uri)
curl -fsS --retry 3 \
"${PUSH_URL}?status=down&msg=${encoded_prob}&details=${encoded_json}"
fi
  • 完全去掉 --data-raw 和 Content-Type,curl 保持 GET。

  • 把原本想 POST 的 JSON 用 details= 参数 URL‑encode 后附在尾部;在 Kuma 的「Maintenance Log」里依然能看到完整内容。

4.3 Cron 不变

1
*/5 * * * * /usr/local/bin/lvm_kuma_push.sh >/dev/null 2>&1

5 验证步骤

  1. 手动执行脚本

    1
    /usr/local/bin/lvm_kuma_push.sh

    在 Kuma web 界面应立即出现一次绿色 Up 心跳。

  2. 模拟磁盘告警

    • 临时把 THRESHOLD=90 改成 1 → 再执行脚本

    • Kuma 立刻标红,并显示 msg 为 JSON 里触发的卷列表

    • 改回 90,空间正常后再次 Up


6 扩展阅读:想用 POST 怎么办?

  1. 升级到 Kuma 2.x β
    2.x 开始重构后端,社区 PR 中已有对 Push 路由的增强;在正式 GA 前可试用 β 版(自行评估风险)。

  2. 反向代理转发
    Nginx 片段示例:

    1
    2
    3
    4
    5
    6
    location /api/push/ {
    proxy_pass_request_body off;
    proxy_pass http://kuma:3001;
    proxy_set_header Content-Length "";
    proxy_set_header X-Original-Method $request_method;
    }

    搭配 Lua / middleware 把 POST 改写成 GET(参考 alertmanager‑kuma‑push 项目)。


7 总结一张图

1
2
3
lvm_check.sh  ──>  lvm_kuma_push.sh (GET)  ──>  Uptime Kuma Push Monitor
↑ JSON ↑ URL 参数
└─────── cron */5 ───────┘
  • 404 根因:旧版 Kuma Push Monitor 不认 POST;去掉正文即可。

  • 零依赖:脚本仍仅需 jq、bc、curl。

  • 未来可扩展:待 Kuma 官方支持 POST 后,再把 --data-raw 加回来即可。

至此,PVE 宿主机磁盘巡检成功接入 Uptime Kuma,并解决了 404 大坑。祝各位再也不怕凌晨磁盘打满!

本文阅读量 --
Author:Margrop
Link:https://blog.margrop.com/post/pve-host-virtual-machine-disk-space-monitor-experience-step-two/
版权声明:本文采用 CC BY-NC-SA 3.0 CN 协议进行许可