소스 수정
This commit is contained in:
@@ -5,10 +5,10 @@ export default defineEventHandler(async (event) => {
|
||||
const DANGER_Z = 3.0
|
||||
|
||||
const servers = await query<any>(`
|
||||
SELECT target_id, name as server_name
|
||||
SELECT target_id, server_name
|
||||
FROM server_targets
|
||||
WHERE is_active = 1
|
||||
ORDER BY name
|
||||
ORDER BY server_name
|
||||
`)
|
||||
|
||||
const anomalies: any[] = []
|
||||
@@ -16,11 +16,11 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
for (const server of servers) {
|
||||
const snapshots = await query<any>(`
|
||||
SELECT cpu_usage as cpu_percent, memory_usage as memory_percent, checked_at as collected_at
|
||||
FROM server_logs
|
||||
SELECT cpu_percent, memory_percent, collected_at
|
||||
FROM server_snapshots
|
||||
WHERE target_id = $1
|
||||
AND checked_at >= NOW() - INTERVAL '1 hour'
|
||||
ORDER BY checked_at DESC
|
||||
AND collected_at::timestamp >= NOW() - INTERVAL '1 hour'
|
||||
ORDER BY collected_at DESC
|
||||
`, [server.target_id])
|
||||
|
||||
if (snapshots.length < 10) {
|
||||
|
||||
Reference in New Issue
Block a user