소스 수정

This commit is contained in:
2025-12-28 16:18:02 +09:00
parent 1801f46c89
commit 56451c8070
4 changed files with 29 additions and 30 deletions

View File

@@ -13,13 +13,13 @@ export default defineEventHandler(async (event) => {
const snapshot = await queryOne(`
SELECT
l.*,
t.name as server_name,
t.host as server_ip
FROM server_logs l
JOIN server_targets t ON l.target_id = t.target_id
WHERE l.target_id = $1
ORDER BY l.checked_at DESC
s.*,
t.server_name,
t.server_ip
FROM server_snapshots s
JOIN server_targets t ON s.target_id = t.target_id
WHERE s.target_id = $1
ORDER BY s.collected_at DESC
LIMIT 1
`, [targetId])

View File

@@ -30,16 +30,15 @@ export default defineEventHandler(async (event) => {
const snapshots = await query(`
SELECT
log_id,
cpu_usage as cpu_percent,
memory_usage as memory_percent,
disk_usage as disk_percent,
is_success as is_online,
checked_at as collected_at
FROM server_logs
snapshot_id,
cpu_percent,
memory_percent,
is_online,
collected_at
FROM server_snapshots
WHERE target_id = $1
AND checked_at >= NOW() - INTERVAL '${interval}'
ORDER BY checked_at ASC
AND collected_at::timestamp >= NOW() - INTERVAL '${interval}'
ORDER BY collected_at ASC
`, [targetId])
return {