Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alert for snapshotter failure in etcd-backup-restore #4094

Merged
merged 1 commit into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pkg/operation/botanist/component/etcd/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const (
monitoringMetricBackupRestoreValidationDurationSecondsBucket = "etcdbr_validation_duration_seconds_bucket"
monitoringMetricBackupRestoreValidationDurationSecondsCount = "etcdbr_validation_duration_seconds_count"
monitoringMetricBackupRestoreValidationDurationSecondsSum = "etcdbr_validation_duration_seconds_sum"
monitoringMetricBackupRestoreSnapshotterFailure = "etcdbr_snapshotter_failure"

monitoringMetricProcessMaxFds = "process_max_fds"
monitoringMetricProcessOpenFds = "process_open_fds"
Expand Down Expand Up @@ -189,6 +190,19 @@ const (
annotations:
description: Etcd data restoration was triggered, but has failed.
summary: Etcd data restoration failure.

# etcd backup failure alert
- alert: KubeEtcdBackupRestore{{ .Role }}Down
rfranzke marked this conversation as resolved.
Show resolved Hide resolved
expr: (sum(up{job="` + monitoringPrometheusJobEtcdNamePrefix + `-{{ .role }}"}) - sum(up{job="` + monitoringPrometheusJobBackupRestoreNamePrefix + `-{{ .role }}"}) > 0) or (rate(` + monitoringMetricBackupRestoreSnapshotterFailure + `{job="` + monitoringPrometheusJobBackupRestoreNamePrefix + `-{{ .role }}"}[5m]) > 0)
for: 10m
labels:
service: etcd
severity: critical
type: seed
visibility: operator
annotations:
description: Etcd backup restore {{ .role }} process down or snapshotter failed with error. Backups will not be triggered unless backup restore is brought back up. This is unsafe behaviour and may cause data loss.
summary: Etcd backup restore {{ .role }} process down or snapshotter failed with error
{{- end }}
`
)
Expand Down Expand Up @@ -234,6 +248,7 @@ var (
monitoringMetricBackupRestoreValidationDurationSecondsBucket,
monitoringMetricBackupRestoreValidationDurationSecondsCount,
monitoringMetricBackupRestoreValidationDurationSecondsSum,
monitoringMetricBackupRestoreSnapshotterFailure,
monitoringMetricProcessResidentMemoryBytes,
monitoringMetricProcessCPUSecondsTotal,
}
Expand Down
15 changes: 14 additions & 1 deletion pkg/operation/botanist/component/etcd/monitoring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ metric_relabel_configs:
action: labeldrop
- source_labels: [ __name__ ]
action: keep
regex: ^(etcdbr_defragmentation_duration_seconds_bucket|etcdbr_defragmentation_duration_seconds_count|etcdbr_defragmentation_duration_seconds_sum|etcdbr_network_received_bytes|etcdbr_network_transmitted_bytes|etcdbr_restoration_duration_seconds_bucket|etcdbr_restoration_duration_seconds_count|etcdbr_restoration_duration_seconds_sum|etcdbr_snapshot_duration_seconds_bucket|etcdbr_snapshot_duration_seconds_count|etcdbr_snapshot_duration_seconds_sum|etcdbr_snapshot_gc_total|etcdbr_snapshot_latest_revision|etcdbr_snapshot_latest_timestamp|etcdbr_snapshot_required|etcdbr_validation_duration_seconds_bucket|etcdbr_validation_duration_seconds_count|etcdbr_validation_duration_seconds_sum|process_resident_memory_bytes|process_cpu_seconds_total)$`
regex: ^(etcdbr_defragmentation_duration_seconds_bucket|etcdbr_defragmentation_duration_seconds_count|etcdbr_defragmentation_duration_seconds_sum|etcdbr_network_received_bytes|etcdbr_network_transmitted_bytes|etcdbr_restoration_duration_seconds_bucket|etcdbr_restoration_duration_seconds_count|etcdbr_restoration_duration_seconds_sum|etcdbr_snapshot_duration_seconds_bucket|etcdbr_snapshot_duration_seconds_count|etcdbr_snapshot_duration_seconds_sum|etcdbr_snapshot_gc_total|etcdbr_snapshot_latest_revision|etcdbr_snapshot_latest_timestamp|etcdbr_snapshot_required|etcdbr_validation_duration_seconds_bucket|etcdbr_validation_duration_seconds_count|etcdbr_validation_duration_seconds_sum|etcdbr_snapshotter_failure|process_resident_memory_bytes|process_cpu_seconds_total)$`

alertingRulesNormal = `groups:
- name: kube-etcd3-` + testRole + `.rules
Expand Down Expand Up @@ -289,6 +289,19 @@ metric_relabel_configs:
annotations:
description: Etcd data restoration was triggered, but has failed.
summary: Etcd data restoration failure.

# etcd backup failure alert
- alert: KubeEtcdBackupRestore` + testROLE + `Down
expr: (sum(up{job="kube-etcd3-` + testRole + `"}) - sum(up{job="kube-etcd3-backup-restore-` + testRole + `"}) > 0) or (rate(etcdbr_snapshotter_failure{job="kube-etcd3-backup-restore-` + testRole + `"}[5m]) > 0)
for: 10m
labels:
service: etcd
severity: critical
type: seed
visibility: operator
annotations:
description: Etcd backup restore ` + testRole + ` process down or snapshotter failed with error. Backups will not be triggered unless backup restore is brought back up. This is unsafe behaviour and may cause data loss.
summary: Etcd backup restore ` + testRole + ` process down or snapshotter failed with error
`

expectedAlertingRulesNormalWithoutBackup = alertingRulesNormal + alertingRulesDefault
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ tests:
- interval: 30s
input_series:
# KubeEtcdTestDown
# KubeEtcdBackupRestoreTestDown
- series: 'up{job="kube-etcd3-test"}'
values: '0+0x30'
values: '0+0x30 1+0x40'
# KubeEtcd3TestNoLeader
- series: 'etcd_server_has_leader{job="kube-etcd3-test"}'
values: '0+0x30'
Expand All @@ -32,6 +33,11 @@ tests:
# KubeEtcdRestorationFailed
- series: 'etcdbr_restoration_duration_seconds_count{job="kube-etcd3-backup-restore-test",succeeded="false"}'
values: '0+0x7 1 2 2'
# KubeEtcdBackupRestoreTestDown
- series: 'up{job="kube-etcd3-backup-restore-test"}'
values: '0+0x60 1+0x10'
- series: 'etcdbr_snapshotter_failure{job="kube-etcd3-backup-restore-test"}'
values: '1+1x30 1+0x40'
alert_rule_test:
- eval_time: 15m
alertname: KubeEtcdTestDown
Expand Down Expand Up @@ -131,3 +137,29 @@ tests:
exp_annotations:
description: Etcd data restoration was triggered, but has failed.
summary: Etcd data restoration failure.
- eval_time: 16m
alertname: KubeEtcdBackupRestoreTestDown
exp_alerts:
- exp_labels:
job: kube-etcd3-backup-restore-test
service: etcd
severity: critical
type: seed
visibility: operator
exp_annotations:
description: Etcd backup restore test process down or snapshotter failed with error. Backups will not be triggered unless backup restore is brought back up. This is unsafe behaviour and may cause data loss.
summary: Etcd backup restore test process down or snapshotter failed with error
- eval_time: 30m
alertname: KubeEtcdBackupRestoreTestDown
exp_alerts:
- exp_labels:
service: etcd
severity: critical
type: seed
visibility: operator
exp_annotations:
description: Etcd backup restore test process down or snapshotter failed with error. Backups will not be triggered unless backup restore is brought back up. This is unsafe behaviour and may cause data loss.
summary: Etcd backup restore test process down or snapshotter failed with error
- eval_time: 35m
alertname: KubeEtcdBackupRestoreTestDown
exp_alerts: