Skip to content
Open
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
1 change: 1 addition & 0 deletions build/pluto/prometheus/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
./exporters/sql.nix
./exporters/up.nix
./exporters/zfs.nix
./exporters/zrepl.nix
];

services.backup.includesZfsDatasets = [ "/var/lib/prometheus2" ];
Expand Down
21 changes: 21 additions & 0 deletions build/pluto/prometheus/exporters/zrepl.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{ ... }:

{
services.prometheus = {
scrapeConfigs = [
{
job_name = "zrepl";
static_configs = [
{
labels.role = "database";
targets = [
"titan.nixos.org:9811"
];
}
];
}
];

# TODO: alert on `zrepl_replication_last_successful` being too long ago.
};
}
16 changes: 16 additions & 0 deletions build/titan/zrepl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
...
}:

let
metricsPort = 9811;
in
{
age.secrets."zrepl-ssh-key" = {
file = ../secrets/zrepl-ssh-key.age;
Expand Down Expand Up @@ -106,6 +109,14 @@
];
};

# https://zrepl.github.io/configuration/monitoring.html
monitoring = [
{
type = "prometheus";
listen = ":${toString metricsPort}";
}
];

jobs = [
# Covers 20240629+
(
Expand All @@ -132,4 +143,9 @@
];
};
};

networking.firewall.extraInputRules = ''
ip6 saddr $prometheus_inet6 tcp dport ${toString metricsPort} accept
ip saddr $prometheus_inet4 tcp dport ${toString metricsPort} accept
'';
}