monitoring: no "Access files changed" alert for a deploy
All checks were successful
nixos / nixos (push) Successful in 35s

On NixOS an activation rewrites accounts and authorized_keys whenever
the configuration changes them, so every such deploy fired the alert
and resolved it minutes later. Each host now records when it last
activated a configuration (nixos_activation_timestamp_seconds, written
on every deploy and boot), and the rule ignores changes within 20
minutes of one. A change outside a deploy, which on these hosts can only
be a hand edit, still fires.

Assisted-by: Claude:opus-5-5
This commit is contained in:
Sergei Poljanski 2026-11-17 09:59:51 +04:00
commit 23b9bede43
Signed by: asxpi
GPG key ID: 4F8851660FA4121B

View file

@ -325,7 +325,8 @@ groups:
- refId: A
relativeTimeRange: { from: 900, to: 0 }
datasourceUid: prometheus
model: { refId: A, expr: "changes(security_fileset_hash[15m])", instant: true, intervalMs: 30000, maxDataPoints: 43200 }
# Not within 20 minutes of a NixOS activation: deploys rewrite accounts and authorized_keys
model: { refId: A, expr: "changes(security_fileset_hash[15m]) unless on(host) (time() - nixos_activation_timestamp_seconds < 1200)", instant: true, intervalMs: 30000, maxDataPoints: 43200 }
- refId: C
datasourceUid: __expr__
model: { refId: C, type: threshold, expression: A, conditions: [ { evaluator: { type: gt, params: [0] } } ] }