Fix NVMe self-tests and mobile layout
This commit is contained in:
15
alerts.go
15
alerts.go
@@ -74,7 +74,10 @@ func evaluateAlerts(metrics dashboardMetrics, thresholds AlertThresholds) []Aler
|
||||
if disk.SMARTStatus == "Ошибка" {
|
||||
add("disk-smart-"+disk.Name, "critical", "Диски", disk.Model+": ошибка SMART", joinReasons(disk.AttentionReasons, "SMART сообщает о неисправности диска."))
|
||||
} else if disk.SMARTStatus == "Требует внимания" {
|
||||
add("disk-smart-"+disk.Name, "warning", "Диски", disk.Model+": SMART требует внимания", joinReasons(disk.AttentionReasons, "Проверьте SMART-показатели диска."))
|
||||
reasons := withoutReason(disk.AttentionReasons, "SMART self-test ещё ни разу не запускался")
|
||||
if len(reasons) > 0 {
|
||||
add("disk-smart-"+disk.Name, "warning", "Диски", disk.Model+": SMART требует внимания", joinReasons(reasons, "Проверьте SMART-показатели диска."))
|
||||
}
|
||||
}
|
||||
if disk.Temperature != nil {
|
||||
limit := thresholds.DiskTempWarning
|
||||
@@ -386,3 +389,13 @@ func joinReasons(reasons []string, fallback string) string {
|
||||
}
|
||||
return strings.Join(reasons, " · ")
|
||||
}
|
||||
|
||||
func withoutReason(reasons []string, excluded string) []string {
|
||||
filtered := make([]string, 0, len(reasons))
|
||||
for _, reason := range reasons {
|
||||
if reason != excluded {
|
||||
filtered = append(filtered, reason)
|
||||
}
|
||||
}
|
||||
return filtered
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user