feat: CPU温度监控 + 端口统一调整为16022
- 添加双CPU Package温度显示 (CPU0/CPU1) - 端口从19013改为16022 - projects.json精简配置,适配hz1服务器 - Git仓库地址更新为新地址
This commit is contained in:
45
app.py
45
app.py
@@ -30,6 +30,27 @@ try:
|
||||
except ImportError:
|
||||
HAS_PSUTIL = False
|
||||
|
||||
# CPU 温度获取
|
||||
def get_cpu_temperatures():
|
||||
"""获取 CPU Package 温度"""
|
||||
temps = {'package_0': None, 'package_1': None}
|
||||
try:
|
||||
result = subprocess.run(['sensors'], capture_output=True, text=True, timeout=5)
|
||||
output = result.stdout
|
||||
# 解析 Package id 0 和 Package id 1
|
||||
for line in output.split('\n'):
|
||||
if 'Package id 0:' in line:
|
||||
match = re.search(r'Package id 0:\s*([+\d.]+)°C', line)
|
||||
if match:
|
||||
temps['package_0'] = float(match.group(1).replace('+', ''))
|
||||
elif 'Package id 1:' in line:
|
||||
match = re.search(r'Package id 1:\s*([+\d.]+)°C', line)
|
||||
if match:
|
||||
temps['package_1'] = float(match.group(1).replace('+', ''))
|
||||
except Exception as e:
|
||||
log_message(f"获取CPU温度失败: {e}")
|
||||
return temps
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
@@ -718,6 +739,9 @@ def api_system_stats():
|
||||
cpu_count = psutil.cpu_count(logical=False) or psutil.cpu_count()
|
||||
cpu_count_logical = psutil.cpu_count(logical=True)
|
||||
|
||||
# CPU 温度
|
||||
cpu_temps = get_cpu_temperatures()
|
||||
|
||||
# 内存
|
||||
mem = psutil.virtual_memory()
|
||||
mem_total_gb = round(mem.total / (1024**3), 2)
|
||||
@@ -769,7 +793,9 @@ def api_system_stats():
|
||||
'cpu': {
|
||||
'percent': cpu_percent,
|
||||
'count': cpu_count,
|
||||
'logical': cpu_count_logical
|
||||
'logical': cpu_count_logical,
|
||||
'temp_package_0': cpu_temps['package_0'],
|
||||
'temp_package_1': cpu_temps['package_1']
|
||||
},
|
||||
'memory': {
|
||||
'total_gb': mem_total_gb,
|
||||
@@ -1377,6 +1403,12 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
|
||||
<div id="cpuBar" class="bg-blue-500 h-4 rounded-full transition-all duration-300" style="width: 0%"></div>
|
||||
</div>
|
||||
<p class="text-gray-400 text-sm">物理核心: <span id="cpuPhysical">-</span> | 逻辑核心: <span id="cpuLogical">-</span></p>
|
||||
<div class="mt-3 pt-3 border-t border-gray-700">
|
||||
<p class="text-gray-400 text-sm flex items-center gap-4">
|
||||
<span><i class="ri-temp-hot-line text-red-400"></i> CPU0: <span id="cpuTemp0" class="text-white font-medium">-</span>°C</span>
|
||||
<span><i class="ri-temp-hot-line text-red-400"></i> CPU1: <span id="cpuTemp1" class="text-white font-medium">-</span>°C</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card rounded-xl p-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
@@ -2114,6 +2146,13 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
|
||||
document.getElementById('cpuBar').style.width = data.cpu.percent + '%';
|
||||
document.getElementById('cpuPhysical').textContent = data.cpu.count;
|
||||
document.getElementById('cpuLogical').textContent = data.cpu.logical;
|
||||
// CPU 温度
|
||||
if (data.cpu.temp_package_0 !== null) {
|
||||
document.getElementById('cpuTemp0').textContent = data.cpu.temp_package_0.toFixed(1);
|
||||
}
|
||||
if (data.cpu.temp_package_1 !== null) {
|
||||
document.getElementById('cpuTemp1').textContent = data.cpu.temp_package_1.toFixed(1);
|
||||
}
|
||||
|
||||
// 内存
|
||||
document.getElementById('memPercent').textContent = data.memory.percent.toFixed(1) + '%';
|
||||
@@ -3372,8 +3411,8 @@ if __name__ == '__main__':
|
||||
|
||||
log_message("=" * 50)
|
||||
log_message("项目服务管理面板 v2.0.0 启动")
|
||||
log_message("访问地址: http://localhost:19013")
|
||||
log_message("访问地址: http://localhost:16022")
|
||||
log_message(f"进程PID: {os.getpid()}")
|
||||
log_message("=" * 50)
|
||||
|
||||
app.run(host='0.0.0.0', port=19013, debug=False)
|
||||
app.run(host='0.0.0.0', port=16022, debug=False)
|
||||
248
projects.json
248
projects.json
@@ -1,234 +1,48 @@
|
||||
{
|
||||
"server": {
|
||||
"name": "hz1-PowerEdge-R730xd",
|
||||
"description": "黄庄1号服务器 - PowerEdge R730xd",
|
||||
"python_path": "/home/hz1/miniconda3/envs/openclaw/bin/python3.12",
|
||||
"updated": "2026-06-01"
|
||||
},
|
||||
"projects": [
|
||||
{
|
||||
"id": "pdf-translate-v2",
|
||||
"name": "PDF翻译助手 V2",
|
||||
"id": "pdf-translate-web",
|
||||
"name": "PDF翻译助手",
|
||||
"type": "web",
|
||||
"ports": [19000],
|
||||
"directory": "works/pdf-translate-web-v2",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 app.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19000/api/health",
|
||||
"ports": [16021],
|
||||
"directory": "works/pdf-translate-web",
|
||||
"start_cmd": "mkdir -p logs && nohup /home/hz1/miniconda3/envs/openclaw/bin/python3.12 app.py > logs/app.log 2>&1 & disown",
|
||||
"stop_cmd": "pkill -f 'python.*pdf-translate-web.*app.py' || true",
|
||||
"health_url": "http://localhost:16021/",
|
||||
"description": "英文PDF翻译中文网站,支持用户系统、会员体系",
|
||||
"admin_url": "http://localhost:19000/admin",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/pdf-translate-web",
|
||||
"version": "v2.1.0"
|
||||
},
|
||||
{
|
||||
"id": "llm-index-rag",
|
||||
"name": "LLM Index RAG",
|
||||
"type": "web",
|
||||
"ports": [19001],
|
||||
"directory": "works/llm-index-rag",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 app.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19001/api/stats",
|
||||
"description": "基于索引和搜索的知识检索系统",
|
||||
"admin_url": "http://localhost:19001/settings",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/llm-index-rag",
|
||||
"version": "v1.1.2"
|
||||
},
|
||||
{
|
||||
"id": "snippet-notes",
|
||||
"name": "碎片信息记录",
|
||||
"type": "web",
|
||||
"ports": [19009],
|
||||
"directory": "works/snippet-notes",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 app.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19009/api/notes",
|
||||
"description": "碎片信息记录工具,AI自动生成标题",
|
||||
"git_repo": null,
|
||||
"version": "v1.0.0"
|
||||
},
|
||||
{
|
||||
"id": "param-hub",
|
||||
"name": "ParamHub Python",
|
||||
"type": "web",
|
||||
"ports": [19010],
|
||||
"directory": "works/param-hub-python",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 app.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19010/api/stats",
|
||||
"description": "AI大模型与硬件参数速查平台",
|
||||
"admin_url": "http://localhost:19010/admin",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/param-hub-python",
|
||||
"version": "v1.2.0"
|
||||
},
|
||||
{
|
||||
"id": "ai-chat-system",
|
||||
"name": "AI对话系统",
|
||||
"type": "web",
|
||||
"ports": [19020],
|
||||
"directory": "works/ai-chat",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 main_v2.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19020/api/admin/stats",
|
||||
"description": "网页端和Matrix端实时同步的AI聊天系统",
|
||||
"admin_url": "http://localhost:19020/admin",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/ai-chat-system",
|
||||
"version": "v2.5.4"
|
||||
},
|
||||
{
|
||||
"id": "ai-chat-app",
|
||||
"name": "AI Chat App",
|
||||
"type": "web",
|
||||
"ports": [19021],
|
||||
"directory": "works/ai-chat-app-new/backend",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 app.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19021/api/config",
|
||||
"description": "AI对话助手移动端应用,智能体对话、TTS语音、思考模式",
|
||||
"admin_url": "http://localhost:19021/admin",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/ai-chat-app-v4",
|
||||
"version": "v3.15.1"
|
||||
},
|
||||
{
|
||||
"id": "product-crawler",
|
||||
"name": "产品参数爬取系统",
|
||||
"type": "web",
|
||||
"ports": [19011],
|
||||
"directory": "/home/xian/.openclaw/common/projects/product-crawler",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 app.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19011/api/products",
|
||||
"description": "自动从官网爬取产品参数信息",
|
||||
"admin_url": "http://localhost:19011/admin",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/product-crawler",
|
||||
"version": "v2.0.0"
|
||||
},
|
||||
{
|
||||
"id": "llm-proxy",
|
||||
"name": "LLM Proxy",
|
||||
"type": "web",
|
||||
"ports": [19007],
|
||||
"directory": "/home/xian/.openclaw/common/projects/llm-proxy",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 app.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19007/health",
|
||||
"description": "大模型API中转系统,多提供商调度",
|
||||
"admin_url": "http://localhost:19007/admin",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/llm-proxy",
|
||||
"admin_url": "http://localhost:16021/admin",
|
||||
"git_repo": "http://121.40.164.32:12007/coder/pdf-translate-web",
|
||||
"version": "v2.0.0"
|
||||
},
|
||||
{
|
||||
"id": "project-panel",
|
||||
"name": "项目服务管理面板",
|
||||
"type": "web",
|
||||
"ports": [19013],
|
||||
"ports": [16022],
|
||||
"directory": "works/project-panel",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 app.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19013/",
|
||||
"start_cmd": "mkdir -p logs && nohup /home/hz1/miniconda3/envs/openclaw/bin/python3.12 app.py > logs/app.log 2>&1 & disown",
|
||||
"stop_cmd": "pkill -f 'python.*project-panel.*app.py' || true",
|
||||
"health_url": "http://localhost:16022/",
|
||||
"description": "统一管理所有Web服务项目",
|
||||
"admin_url": "http://localhost:19013",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/project-panel",
|
||||
"version": "v1.0.1"
|
||||
},
|
||||
"admin_url": "http://localhost:16022",
|
||||
"git_repo": "http://121.40.164.32:12007/coder/project-panel",
|
||||
"version": "v2.0.0"
|
||||
}
|
||||
],
|
||||
"external_services": [
|
||||
{
|
||||
"id": "web-context-extension",
|
||||
"name": "网页助手插件",
|
||||
"type": "extension",
|
||||
"directory": "works/web-context-extension",
|
||||
"description": "浏览器扩展,右键菜单支持收藏网页、AI总结",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/web-context-extension",
|
||||
"version": "v0.1.0"
|
||||
},
|
||||
{
|
||||
"id": "service-monitor",
|
||||
"name": "Web服务监控",
|
||||
"type": "cron",
|
||||
"directory": "works/service-monitor",
|
||||
"cron": "*/20 * * * *",
|
||||
"cron_cmd": "/usr/bin/python3 /home/xian/.openclaw/workspace-coder/works/service-monitor/monitor.py",
|
||||
"description": "每20分钟检查服务状态,邮件通知",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/service-monitor",
|
||||
"version": "v1.0.0"
|
||||
},
|
||||
{
|
||||
"id": "board-monitor",
|
||||
"name": "A股板块监控",
|
||||
"type": "cron",
|
||||
"directory": "works/board-monitor",
|
||||
"cron": "0 17 * * 1-5",
|
||||
"cron_cmd": "python3 board_monitor.py report",
|
||||
"description": "每个交易日17:00发送板块分析报告",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/board-monitor",
|
||||
"version": "v1.3.0"
|
||||
},
|
||||
{
|
||||
"id": "stock-system",
|
||||
"name": "A股历史数据系统",
|
||||
"type": "cli",
|
||||
"directory": "/home/xian/.openclaw/common/stock_system",
|
||||
"run_cmd": "python3 fetch_history_v2.py",
|
||||
"description": "获取A股历史行情数据,支持断点续传",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/stock_system",
|
||||
"version": "v0.2.0"
|
||||
},
|
||||
{
|
||||
"id": "pdf-translator",
|
||||
"name": "PDF翻译脚本",
|
||||
"type": "cli",
|
||||
"directory": "works/pdf-translator",
|
||||
"run_cmd": "python3 translate_pdf.py",
|
||||
"description": "命令行PDF翻译工具",
|
||||
"git_repo": null,
|
||||
"version": "v1.0.0"
|
||||
},
|
||||
{
|
||||
"id": "xian-favor",
|
||||
"name": "Xian Favor 收藏系统",
|
||||
"type": "web",
|
||||
"ports": [19014],
|
||||
"directory": "works/xian-favor",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 -c \"from xian_favor.api import start_server; start_server(port=19014)\" > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19014/api/items?limit=1",
|
||||
"description": "文本笔记、链接收藏、待办事项管理系统",
|
||||
"admin_url": "http://localhost:19014",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/xian-favor",
|
||||
"version": "v3.5.0"
|
||||
},
|
||||
{
|
||||
"id": "multi-agent-bidding",
|
||||
"name": "多智能体竞标调度系统",
|
||||
"type": "web",
|
||||
"ports": [19015],
|
||||
"directory": "works/multi-agent-bidding",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 -m app.app --port 19015 > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19015/api/agents",
|
||||
"description": "基于竞标机制的多智能体任务调度系统",
|
||||
"admin_url": "http://localhost:19015",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/multi-agent-bidding",
|
||||
"version": "v1.0.0"
|
||||
},
|
||||
{
|
||||
"id": "tech-forum",
|
||||
"name": "技术论坛",
|
||||
"type": "web",
|
||||
"ports": [19004],
|
||||
"directory": "/home/xian/.openclaw/common/projects/tech-forum",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 backend/app.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19004/api/health",
|
||||
"description": "技术交流、工具分享、问答讨论社区",
|
||||
"admin_url": "http://localhost:19004/admin",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/tech-forum",
|
||||
"version": "v1.2.0"
|
||||
},
|
||||
{
|
||||
"id": "image-editor",
|
||||
"name": "图片编辑器",
|
||||
"type": "web",
|
||||
"ports": [19018],
|
||||
"directory": "works/image-editor",
|
||||
"start_cmd": "mkdir -p logs && nohup python3 app.py > logs/app.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19018/api/health",
|
||||
"description": "前端图片处理:合并、分割、挖孔、圆形切图、文字图片",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/image-editor",
|
||||
"version": "v1.2.1"
|
||||
},
|
||||
{
|
||||
"id": "voice-chat-web",
|
||||
"name": "语音对话网页",
|
||||
"type": "web",
|
||||
"ports": [19019],
|
||||
"directory": "works/voice-chat-web",
|
||||
"start_cmd": "mkdir -p logs && MODEL_SERVICE_URL=http://192.168.2.5:12001 nohup python3 main.py > logs/server.log 2>&1 & disown",
|
||||
"health_url": "http://localhost:19019/api/status",
|
||||
"description": "基于Qwen2-Audio的语音交互网页,支持录音和文字对话",
|
||||
"git_repo": "http://192.168.2.8:12007/coder/voice-chat-web",
|
||||
"version": "v1.2.0"
|
||||
"id": "meilisearch",
|
||||
"name": "Meilisearch 搜索引擎",
|
||||
"type": "external",
|
||||
"ports": [16001],
|
||||
"health_url": "http://localhost:16001/health",
|
||||
"description": "高性能搜索引擎,只读监控"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user