Improve service checks and system health details
This commit is contained in:
14
alerts.go
14
alerts.go
@@ -141,12 +141,14 @@ func evaluateAlerts(metrics dashboardMetrics, thresholds AlertThresholds) []Aler
|
||||
}
|
||||
}
|
||||
for _, service := range metrics.Services.Services {
|
||||
if !service.Up {
|
||||
add(fmt.Sprintf("service-%d", service.ID), "critical", "Сервисы", service.Name+": недоступен", service.Error)
|
||||
} else if service.TLSDays != nil && *service.TLSDays < 0 {
|
||||
add(fmt.Sprintf("service-tls-%d", service.ID), "critical", "Сервисы", service.Name+": сертификат истёк", fmt.Sprintf("Истёк %d дн. назад.", -*service.TLSDays))
|
||||
} else if service.TLSDays != nil && *service.TLSDays < 14 {
|
||||
add(fmt.Sprintf("service-tls-%d", service.ID), "warning", "Сервисы", service.Name+": сертификат скоро истечёт", fmt.Sprintf("Осталось %d дн.", *service.TLSDays))
|
||||
for _, endpoint := range service.Endpoints {
|
||||
if !endpoint.Up {
|
||||
add(fmt.Sprintf("service-%d-%s", service.ID, endpoint.Kind), "critical", "Сервисы", service.Name+": недоступен "+strings.ToLower(endpoint.Label), endpoint.Error)
|
||||
} else if endpoint.TLSDays != nil && *endpoint.TLSDays < 0 {
|
||||
add(fmt.Sprintf("service-tls-%d-%s", service.ID, endpoint.Kind), "critical", "Сервисы", service.Name+": сертификат истёк", fmt.Sprintf("%s: истёк %d дн. назад.", endpoint.Label, -*endpoint.TLSDays))
|
||||
} else if endpoint.TLSDays != nil && *endpoint.TLSDays < 14 {
|
||||
add(fmt.Sprintf("service-tls-%d-%s", service.ID, endpoint.Kind), "warning", "Сервисы", service.Name+": сертификат скоро истечёт", fmt.Sprintf("%s: осталось %d дн.", endpoint.Label, *endpoint.TLSDays))
|
||||
}
|
||||
}
|
||||
}
|
||||
if metrics.SystemHealth.FailedUnits > 0 {
|
||||
|
||||
Reference in New Issue
Block a user