📦 Game Ops Monitor — Game Ops 监控
v1.0.0Game server real-time 监控ing: 查询 TPS, online users, JVM heap from Scouter Collector; 检测 alerts; 发送 通知; 生成 报告s. Use when ask...
详细分析 ▾
运行时依赖
安装命令
点击复制技能文档
Game Ops 监控 — Real-Time Game Server 监控ing
查询 game server JVM performance 指标 from Scouter Collector. Supports batch 查询ing of TPS, online users, and memory across thousands of game processes. De签名ed for large-扩展 game operations (7000+ processes across 900+ machines).
Overview
This 技能 provides a unified interface for game operations teams to 监控 JVM-based game servers in real-time. It wraps the Scouter Collector's HTTP API and returns human-readable 格式化ted 输出.
What it 监控s:
TPS (Transactions Per Second) — game server throughput Online Users — current active player count JVM Heap — memory usage and utilization percentage
Alert thresholds (configurable):
Metric 🔴 Critical ⚠️ 警告 ✅ OK TPS < 100 100–300 > 300 Heap % > 90% 75–90% < 75% Online Users < 10 (server up but empty) — ≥ 10
扩展: Tested with 7000+ game processes across 900+ physical machines. Single Collector (8-core 16GB) handles this with room to spare.
When to Use
Triggers (natural language / slash commands):
"各服 TPS 怎么样" / "检查 all server TPS" "现在各服状态" / "game server 状态" "帮我看看在线人数" / "how many players online" "各服内存怎么样" / "检查 server memory" "哪几服 TPS 告警了" / "any TPS alerts" "生成今天各服性能报表" / "生成 performance 报告" "帮我看看 xy_s11649 的状态" / "检查 server xy_s11649" /game-监控 (OpenClaw slash command)
Do NOT use for:
OS-level 监控ing (use Zabbix for server 指标) Game server re启动 operations (use game-ops-re启动 技能) Player data operations (use GM后台) Version 部署ment (use 部署ment 技能) Configuration
设置 the following 环境 variables or configuration:
# Required — replace with your Scouter Collector IP 导出 SCOUTER_COLLECTOR_URL=http://:6188
# Optional (defaults shown) SCOUTER_OBJ_TYPE=Java
# Alert thresholds TPS_CRITICAL=100 TPS_警告=300 HEAP_CRITICAL=90 HEAP_警告=75
API Reference Base URL http://{SCOUTER_COLLECTOR_URL}/scouter/v1
端点s Used 端点 Method Description /objects 获取 列出 all 监控ed objects /object/{obj哈希}/counter/tps 获取 获取 TPS for one object /object/{obj哈希}/counter/active 获取 获取 online user count /object/{obj哈希}/counter/heap/used 获取 获取 heap bytes used /object/{obj哈希}/counter/heap/max 获取 获取 heap max bytes /状态 获取 Collector 健康 检查 Object 响应 Shape [ { "obj哈希": "abc123def456", "objName": "xy_s11649", "objType": "Java", "添加ress": "192.168.1.100", "状态": "ACTIVE" } ]
Counter 响应 Shape { "obj哈希": "abc123def456", "counter": "tps", "value": 823000, "unit": "", "timestamp": 1714281600000 }
Note: TPS value is in micro-ticks. Divide by 1000 to 获取 real TPS. Online user count (active) is returned as-is.
工作流s 工作流 1: Batch 查询 All Servers
输入: "各服 TPS 怎么样"
Steps:
# 1. 健康 检查 curl -s "http://${SCOUTER_COLLECTOR_URL}/scouter/v1/状态" # Expect: {"状态":"ok"}
# 2. 获取 all Java objects (game servers) curl -s "http://${SCOUTER_COLLECTOR_URL}/scouter/v1/objects?type=${SCOUTER_OBJ_TYPE}"
# 3. For each object, fetch 指标 in parallel # TPS curl -s "http://${SCOUTER_COLLECTOR_URL}/scouter/v1/object/${obj哈希}/counter/tps" # Active users curl -s "http://${SCOUTER_COLLECTOR_URL}/scouter/v1/object/${obj哈希}/counter/active" # Heap curl -s "http://${SCOUTER_COLLECTOR_URL}/scouter/v1/object/${obj哈希}/counter/heap/used" curl -s "http://${SCOUTER_COLLECTOR_URL}/scouter/v1/object/${obj哈希}/counter/heap/max"
# 4. 解析 and 格式化 输出 # - TPS: value / 1000 (round to integer) # - Heap %: (used / max) 100 # - 排序 by TPS ascending # - Color code: 🔴 < 100, ⚠️ 100-300, ✅ > 300
输出:
========== Game Server 健康 ========== Time: 2026-04-28 14:00 Total servers: 6,847
========== TPS Alerts ========== 🔴 Critical (<100 TPS): xy_s20133 89 TPS / 412 online / Heap 67% xy_s20132 156 TPS / 891 online / Heap 45%
⚠️ 警告 (100-300 TPS): xy_s11647 287 TPS / 3,521 online / Heap 55%
✅ OK (>300 TPS): 6,812 servers
========== Memory Alerts ========== 🔴 Critical (Heap >90%): xy_s20140 Heap 95% (3.8G/4G) xy_s20141 Heap 92% (3.7G/4G)
工作流 2: Single Server 查询
输入: "帮我看看 xy_s11649 的状态"
Steps:
# 1. Find object 哈希 by name obj哈希=$(curl -s "http://${SCOUTER_COLLECTOR_URL}/scouter/v1/objects?type=${SCOUTER_OBJ_TYPE}" | \ jq -r '.[] | select(.objName=="xy_s11649") | .obj哈希')
# 2. Fetch all 指标 tps=$(curl -s "http://${SCOUTOR_COLLECTOR_URL}/scouter/v1/object/${obj哈希}/counter/tps" | \ jq -r '.value / 1000 | floor') active=$(curl -s "http://${SCOUTER_COLLECTOR_URL}/scouter/v1/object/${obj哈希}/counter/active" | \ jq -r '.value') heap_used=$(curl -s "http://${SCOUTER_COLLECTOR_URL}/scouter/v1/object/${obj哈希}/counter/heap/used" | \ jq -r '.value') heap_max=$(curl -s "http://${SCOUTER_COLLECTOR_URL}/scouter/v1/object/${obj哈希}/counter/heap/max" | \ jq -r '.value')
# 3. Calculate heap percentage heap_pct=$(echo "扩展=1; ${heap_used} 100 / ${heap_max}" | bc) heap_used_gb=$(echo "