Add read-only guest monitoring agents
This commit is contained in:
16
alerts.go
16
alerts.go
@@ -197,6 +197,22 @@ func evaluateAlerts(metrics dashboardMetrics, thresholds AlertThresholds) []Aler
|
||||
add("guests-stopped", "info", "VM/LXC", "Есть остановленные гости", fmt.Sprintf("Остановлено VM/LXC: %d. Это уведомление информационное.", stopped))
|
||||
}
|
||||
}
|
||||
for _, agent := range metrics.Agents {
|
||||
vmSuffix := fmt.Sprintf("-%d", agent.VMID)
|
||||
if !agent.Online {
|
||||
add("agent-offline-"+agent.ID+vmSuffix, "critical", "Агенты", agent.Name+": агент не отвечает", fmt.Sprintf("Последний heartbeat: %s назад. VMID %d.", time.Since(time.Unix(agent.LastSeen, 0)).Round(time.Second), agent.VMID))
|
||||
continue
|
||||
}
|
||||
if agent.Report.DockerAvailable {
|
||||
for _, container := range agent.Report.Containers {
|
||||
if container.State != "running" {
|
||||
add("agent-container-stopped-"+agent.ID+"-"+container.ID+vmSuffix, "warning", "Docker", agent.Name+": контейнер "+container.Name+" остановлен", fmt.Sprintf("%s · VMID %d.", container.Status, agent.VMID))
|
||||
} else if container.Health == "unhealthy" {
|
||||
add("agent-container-health-"+agent.ID+"-"+container.ID+vmSuffix, "critical", "Docker", agent.Name+": контейнер "+container.Name+" unhealthy", fmt.Sprintf("Docker health-check не проходит · VMID %d.", agent.VMID))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, service := range metrics.Services.Services {
|
||||
for _, endpoint := range service.Endpoints {
|
||||
if !endpoint.Up {
|
||||
|
||||
Reference in New Issue
Block a user