feat(agent): persist 7-day metrics history per server heartbeat

- New table servidor_metricas_history (cpu%, ram%, swap%, disco%, tcp, load1)
- Each heartbeat inserts a compact row (~60 bytes)
- GET /app/servidor/:id/metricas-history?horas=24 returns the data
- Daily cron at 3AM purges rows older than 7 days
- ~1.2 MB per server per 7 days at 30s interval

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-25 11:03:16 -05:00
co-authored by Claude Sonnet 4.6
parent 4b98161070
commit ae74d0ef90
5 changed files with 127 additions and 0 deletions
+2
View File
@@ -96,6 +96,8 @@ func Migrate() {
&models.VcardApiConfig{},
// Integración Coolify
&models.CoolifyConfig{},
// Historial de métricas del agente
&models.ServidorMetricasHistory{},
); err != nil {
log.Fatalf("Error during main migration: %v", err)
}