Install
openclaw skills install traffic-monitor监控服务器指定网卡月度网络流量,定期生成使用报告并在流量超过80%阈值时提供警告。
openclaw skills install traffic-monitorversion: 1.0.0
监控服务器网络流量使用情况,定期报告月度流量消耗。
服务器每月有 2T 流量限制,需要监控使用情况避免超额。
# 查看当前月度流量
vnstat -m -i eth0
# 查看实时流量
vnstat -l -i eth0
# 查看日流量
vnstat -d -i eth0
# 查看流量摘要
traffic_report.py
生成人类可读的流量报告:
python3 ~/.openclaw/skills/traffic-monitor/traffic_report.py
输出示例:
📊 本月流量统计
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📥 入站: 125.3 GB
📤 出站: 89.2 GB
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📦 总计: 214.5 GB / 2048 GB (10.5%)
⚠️ 剩余: 1833.5 GB
可以在 HEARTBEAT.md 中添加流量检查:
## 流量检查(每天一次)
- 运行 traffic_report.py
- 如果使用超过 80%,发送警告
systemctl status vnstat# 检查 vnstat 服务状态
systemctl status vnstat
# 重启 vnstat
systemctl restart vnstat
# 查看所有接口
vnstat --iflist
# 导出 JSON 格式
vnstat -m -i eth0 --json