|
| 1 | +## PV reclaim-policy backup-coverage alarm. |
| 2 | +## |
| 3 | +## Source: gauge `pv_reclaim_policy_violation{namespace,pvc,reason}` |
| 4 | +## pushed by Windmill `f/infra_health/pv_reclaim_policy_analysis` |
| 5 | +## (daily 08:00 Zurich). Any Delete-policy PV that doesn't match |
| 6 | +## either SAFE_DELETE patterns, a Longhorn recurring-job-group label, |
| 7 | +## or the BACKED_UP_BY_WINDMILL allowlist gets a violation row. |
| 8 | +## |
| 9 | +## 24h `for:` deliberately wide so transient catalog gaps during |
| 10 | +## namespace creation / chart upgrades don't fire — and aligns with |
| 11 | +## the daily audit cadence (one missed run shouldn't page). |
| 12 | + |
| 13 | +apiVersion: monitoring.coreos.com/v1 |
| 14 | +kind: PrometheusRule |
| 15 | +metadata: |
| 16 | + name: app-pv-reclaim-policy |
| 17 | + namespace: monitoring |
| 18 | +spec: |
| 19 | + groups: |
| 20 | + - name: app-pv-reclaim-policy.coverage |
| 21 | + rules: |
| 22 | + - alert: PVMissingBackupStrategy |
| 23 | + expr: pv_reclaim_policy_violation == 1 |
| 24 | + for: 24h |
| 25 | + labels: |
| 26 | + severity: warning |
| 27 | + component: storage |
| 28 | + annotations: |
| 29 | + summary: 'PV {{ $labels.namespace }}/{{ $labels.pvc }} has no backup strategy' |
| 30 | + description: | |
| 31 | + PV bound to {{ $labels.namespace }}/{{ $labels.pvc }} uses reclaimPolicy: Delete |
| 32 | + but does NOT match any backup-coverage rule: |
| 33 | + - not in SAFE_DELETE (ephemeral by name/pattern) |
| 34 | + - no recurring-job-group.longhorn.io/* label |
| 35 | + - not in f/infra_health/pv_reclaim_policy_analysis BACKED_UP_BY_WINDMILL |
| 36 | + Reason: {{ $labels.reason }}. |
| 37 | + Either flip the PV to Retain, add a Longhorn recurring backup label, |
| 38 | + or wire up a Windmill backup script and add it to the allowlist. |
| 39 | +
|
| 40 | + - alert: PVReclaimPolicyAuditStale |
| 41 | + ## Audit script not pushing fresh metrics: gauge stops updating. |
| 42 | + ## Pushgateway keeps the last value forever; freshness lives in |
| 43 | + ## the dedicated _last_run_timestamp_seconds gauge. |
| 44 | + expr: | |
| 45 | + (time() - pv_reclaim_policy_analysis_last_run_timestamp_seconds) > 36*3600 |
| 46 | + for: 30m |
| 47 | + labels: |
| 48 | + severity: warning |
| 49 | + component: storage |
| 50 | + annotations: |
| 51 | + summary: 'PV reclaim policy audit stale (>36h since last successful run)' |
| 52 | + description: | |
| 53 | + f/infra_health/pv_reclaim_policy_analysis hasn't pushed a fresh |
| 54 | + timestamp gauge in >36h. Daily schedule is broken or the |
| 55 | + push to Pushgateway is failing — alert masks the data, fix the |
| 56 | + probe. |
0 commit comments