50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
모니터링 데이터 수집 테스트
|
|
"""
|
|
import asyncio
|
|
import json
|
|
import sys
|
|
import os
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
from app.monitoring.dashboard import monitoring_data
|
|
|
|
async def test_monitoring():
|
|
"""모니터링 데이터 수집을 테스트합니다."""
|
|
try:
|
|
print("모니터링 데이터 수집 테스트 시작...")
|
|
|
|
# 데이터 수집
|
|
data = await monitoring_data.collect_data()
|
|
|
|
print("✅ 데이터 수집 성공!")
|
|
print(f"📊 데이터 키들: {list(data.keys())}")
|
|
|
|
# 주요 정보 출력
|
|
if 'system_type' in data:
|
|
print(f"🖥️ 시스템 타입: {data['system_type']}")
|
|
|
|
if 'gpu' in data:
|
|
print(f"🎮 GPU 정보: {data['gpu']}")
|
|
|
|
if 'workers' in data:
|
|
print(f"⚙️ 워커 상태: {data['workers']}")
|
|
|
|
if 'sessions' in data:
|
|
print(f"🔗 세션 풀: {data['sessions']}")
|
|
|
|
# JSON 형태로 저장 (디버깅용)
|
|
with open('monitoring_debug.json', 'w', encoding='utf-8') as f:
|
|
json.dump(data, f, indent=2, ensure_ascii=False, default=str)
|
|
|
|
print("💾 디버그 데이터가 monitoring_debug.json에 저장되었습니다.")
|
|
|
|
except Exception as e:
|
|
print(f"❌ 모니터링 데이터 수집 실패: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test_monitoring())
|