Files
nmon/internal/alert/system.go

32 lines
1.6 KiB
Go

package alert
import "strings"
// Rule names of subsystem alarms: conditions a collection path or background
// job reports itself (a push sender over its cap, a month's p95 not
// materialised, the rollup not running) rather than ones found by a metric
// query. The app persists and delivers these rows; the metric-rule evaluator
// leaves them alone.
const (
// RuleIngestPrefix plus an ingest alarm kind ("series_cap", "rate_limit", ...) names a push-ingest alarm.
RuleIngestPrefix = "ingest_"
// RuleP95Late is a monthly p95 not materialised more than a day after the month ended.
RuleP95Late = "p95_late"
// RuleRollupStalled is the rollup job failing for longer than its tolerance.
RuleRollupStalled = "rollup_stalled"
// RuleBreakGlassPrefix starts the break-glass alarms: breakglass_login, breakglass_failure, breakglass_locked.
RuleBreakGlassPrefix = "breakglass_"
// RuleBackupFailed is the nightly backup failing; it closes when the next backup succeeds.
RuleBackupFailed = "backup_failed"
)
// SystemRule reports whether name is a subsystem alarm rule.
func SystemRule(name string) bool {
return name == RuleP95Late || name == RuleBackupFailed || name == RuleRollupStalled || strings.HasPrefix(name, RuleIngestPrefix) ||
diskGuardRules[name] || strings.HasPrefix(name, RuleBreakGlassPrefix)
}
// diskGuardRules are the disk guard's alarm kinds (internal/diskguard). They are listed rather than matched by a
// "disk_" prefix because the shipped metric rule "disk_full" shares it.
var diskGuardRules = map[string]bool{"disk_high": true, "disk_series_halt": true, "disk_reserve": true, "disk_statfs": true}