main
nix 42 lines 953 Bytes
Raw
1 { pkgs, ... }:
2
3 {
4 services.prometheus = {
5 scrapeConfigs = [
6 {
7 job_name = "zrepl";
8 static_configs = [
9 {
10 labels.role = "database";
11 targets = [
12 "mimas.nixos.org:9811"
13 ];
14 }
15 ];
16 }
17 ];
18
19 ruleFiles = [
20 (pkgs.writeText "zrepl.rules" (
21 builtins.toJSON {
22 groups = [
23 {
24 name = "zrepl";
25 rules = [
26 {
27 alert = "ZreplLongTimeNoSuccess";
28 expr = ''
29 time() - zrepl_replication_last_successful > ${toString (6 * 60 * 60)}
30 '';
31 for = "6h";
32 labels.severity = "warning";
33 annotations.summary = "zrepl job {{ $labels.zrepl_job }} has not succeeded recently.";
34 }
35 ];
36 }
37 ];
38 }
39 ))
40 ];
41 };
42 }