monitoring: no "Access files changed" alert for a deploy
All checks were successful
nixos / nixos (push) Successful in 35s
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:
parent
3edcdce243
commit
23b9bede43
1 changed files with 15 additions and 1 deletions
|
|
@ -190,6 +190,19 @@ in
|
|||
|
||||
systemd.tmpfiles.rules = [ "d ${textfile} 0755 root root -" ];
|
||||
|
||||
# When this host last activated a NixOS configuration (deploy or
|
||||
# boot). Activations rewrite accounts and authorized_keys by design;
|
||||
# the "Access files changed" alert stays quiet around them and still
|
||||
# fires for a change outside a deploy, which here means a hand edit.
|
||||
system.activationScripts.activationMetric = {
|
||||
deps = [ ];
|
||||
text = ''
|
||||
mkdir -p ${textfile}
|
||||
printf '# HELP nixos_activation_timestamp_seconds Last NixOS activation (deploy or boot).\n# TYPE nixos_activation_timestamp_seconds gauge\nnixos_activation_timestamp_seconds %s\n' "$(${pkgs.coreutils}/bin/date +%s)" > ${textfile}/nixos.prom.tmp
|
||||
mv ${textfile}/nixos.prom.tmp ${textfile}/nixos.prom
|
||||
'';
|
||||
};
|
||||
|
||||
services.prometheus.exporters.node = {
|
||||
enable = true;
|
||||
listenAddress = ip;
|
||||
|
|
|
|||
Loading…
Reference in a new issue