Add monitoring features and alert configurations
- Introduced new system metrics tracking with the ability to save and retrieve metrics such as CPU usage, memory usage, and network latency. - Added alert configuration functionality, allowing users to set thresholds for metrics and receive notifications via email or chat. - Updated the sidebar component to include a new "Monitorar SGSE" card for real-time system monitoring. - Enhanced the package dependencies with `papaparse` and `svelte-chartjs` for improved data handling and charting capabilities. - Updated the schema to support new tables for system metrics and alert configurations.
This commit is contained in:
@@ -634,4 +634,54 @@ export default defineSchema({
|
||||
})
|
||||
.index("by_conversa", ["conversaId", "iniciouEm"])
|
||||
.index("by_usuario", ["usuarioId"]),
|
||||
|
||||
// Tabelas de Monitoramento do Sistema
|
||||
systemMetrics: defineTable({
|
||||
timestamp: v.number(),
|
||||
// Métricas de Sistema
|
||||
cpuUsage: v.optional(v.number()),
|
||||
memoryUsage: v.optional(v.number()),
|
||||
networkLatency: v.optional(v.number()),
|
||||
storageUsed: v.optional(v.number()),
|
||||
// Métricas de Aplicação
|
||||
usuariosOnline: v.optional(v.number()),
|
||||
mensagensPorMinuto: v.optional(v.number()),
|
||||
tempoRespostaMedio: v.optional(v.number()),
|
||||
errosCount: v.optional(v.number()),
|
||||
})
|
||||
.index("by_timestamp", ["timestamp"]),
|
||||
|
||||
alertConfigurations: defineTable({
|
||||
metricName: v.string(),
|
||||
threshold: v.number(),
|
||||
operator: v.union(
|
||||
v.literal(">"),
|
||||
v.literal("<"),
|
||||
v.literal(">="),
|
||||
v.literal("<="),
|
||||
v.literal("==")
|
||||
),
|
||||
enabled: v.boolean(),
|
||||
notifyByEmail: v.boolean(),
|
||||
notifyByChat: v.boolean(),
|
||||
createdBy: v.id("usuarios"),
|
||||
lastModified: v.number(),
|
||||
})
|
||||
.index("by_enabled", ["enabled"]),
|
||||
|
||||
alertHistory: defineTable({
|
||||
configId: v.id("alertConfigurations"),
|
||||
metricName: v.string(),
|
||||
metricValue: v.number(),
|
||||
threshold: v.number(),
|
||||
timestamp: v.number(),
|
||||
status: v.union(v.literal("triggered"), v.literal("resolved")),
|
||||
notificationsSent: v.object({
|
||||
email: v.boolean(),
|
||||
chat: v.boolean(),
|
||||
}),
|
||||
})
|
||||
.index("by_timestamp", ["timestamp"])
|
||||
.index("by_status", ["status"])
|
||||
.index("by_config", ["configId", "timestamp"]),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user