- base.html 상단 네비게이션 브랜딩 변경 - 팜큐 약국 관리 시스템 → PharmQ Super Admin (PSA) - UI 일관성 향상을 위한 브랜딩 통합 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
79 lines
3.1 KiB
Python
79 lines
3.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
머신 상세 정보 디버깅
|
|
"""
|
|
|
|
from utils.database import init_database, get_session, get_machine_with_details
|
|
from models import Node, MachineSpecs, MonitoringData, PharmacyInfo
|
|
|
|
def debug_machine_detail(machine_id=1):
|
|
"""머신 상세 정보 디버깅"""
|
|
print(f"🔍 Debugging machine detail for ID: {machine_id}")
|
|
|
|
session = get_session()
|
|
|
|
try:
|
|
# 1. 머신 정보 확인
|
|
machine = session.query(Node).filter_by(id=machine_id).first()
|
|
print(f"📱 Machine: {machine}")
|
|
if machine:
|
|
print(f" - ID: {machine.id}")
|
|
print(f" - Hostname: {machine.hostname}")
|
|
print(f" - Given Name: {machine.given_name}")
|
|
print(f" - User ID: {machine.user_id}")
|
|
print(f" - IPv4: {machine.ipv4}")
|
|
print(f" - Last Seen: {machine.last_seen}")
|
|
|
|
# is_online 메서드 테스트
|
|
try:
|
|
online_status = machine.is_online()
|
|
print(f" - Online Status: {online_status}")
|
|
except Exception as e:
|
|
print(f" - Online Status Error: {e}")
|
|
|
|
# 2. 머신 스펙 확인
|
|
specs = session.query(MachineSpecs).filter_by(machine_id=machine_id).first()
|
|
print(f"💾 Specs: {specs}")
|
|
if specs:
|
|
print(f" - CPU: {specs.cpu_model}")
|
|
print(f" - RAM: {specs.ram_gb}GB")
|
|
print(f" - Storage: {specs.storage_gb}GB")
|
|
|
|
# 3. 모니터링 데이터 확인
|
|
monitoring = session.query(MonitoringData).filter_by(
|
|
machine_id=machine_id
|
|
).order_by(MonitoringData.collected_at.desc()).first()
|
|
print(f"📊 Latest Monitoring: {monitoring}")
|
|
if monitoring:
|
|
print(f" - CPU Usage: {monitoring.cpu_usage}%")
|
|
print(f" - Temperature: {monitoring.cpu_temperature}°C")
|
|
print(f" - Collected at: {monitoring.collected_at}")
|
|
|
|
# 4. get_machine_with_details 함수 테스트
|
|
print(f"\n🧪 Testing get_machine_with_details function...")
|
|
try:
|
|
details = get_machine_with_details(machine_id)
|
|
print(f" ✅ Success: {details is not None}")
|
|
if details:
|
|
print(f" - Machine: {details['machine'].hostname if details['machine'] else None}")
|
|
print(f" - Specs: {details['specs'] is not None}")
|
|
print(f" - Monitoring: {details['latest_monitoring'] is not None}")
|
|
print(f" - Online: {details['is_online']}")
|
|
print(f" - Pharmacy: {details['pharmacy']}")
|
|
except Exception as e:
|
|
print(f" ❌ Error: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
except Exception as e:
|
|
print(f"❌ Database error: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
finally:
|
|
session.close()
|
|
|
|
if __name__ == '__main__':
|
|
# 데이터베이스 초기화
|
|
init_database('sqlite:///srv/headscale-setup/data/db.sqlite')
|
|
debug_machine_detail(1) |