mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
feat(monitoring): scrape the restic rest-server
Expose /metrics on the loopback-bound server, scrape it with victoriametrics, and block /metrics on the public vhost.
This commit is contained in:
1 parent
1cbb52add1
commit
842cd26f64
3 files changed
+23
No files matched your search
@@ -73,6 +73,10 @@ in
|
||||
dataDir = "/data/backups/rest-server";
|
||||
privateRepos = true;
|
||||
"htpasswd-file" = config.age.secrets."restic-rest-htpasswd".path;
|
||||
# expose /metrics for victoriametrics; unauthenticated is fine because the
|
||||
# server only listens on loopback
|
||||
prometheus = true;
|
||||
extraFlags = [ "--prometheus-no-auth" ];
|
||||
};
|
||||
|
||||
# repositories live on the HDD, which has to be mounted first
|
||||
|
||||
@@ -66,6 +66,9 @@ in
|
||||
# the restic REST server the backup clients push to
|
||||
virtualHosts."restic.writefor.fun".extraConfig = ''
|
||||
${hostCommonConfig}
|
||||
# metrics are scraped over loopback only, never through this vhost
|
||||
@metrics path /metrics
|
||||
respond @metrics 403
|
||||
reverse_proxy http://localhost:8000
|
||||
'';
|
||||
# Every other name is not a service on this host: answer 404 instead of
|
||||
|
||||
@@ -77,6 +77,22 @@ in
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
job_name = "restic-rest-server";
|
||||
scrape_interval = "60s";
|
||||
metrics_path = "/metrics";
|
||||
static_configs = [
|
||||
{
|
||||
# same-host rest-server bound to loopback (127.0.0.1:8000)
|
||||
targets = [ "127.0.0.1:8000" ];
|
||||
labels.type = "app";
|
||||
labels.app = "restic";
|
||||
labels.host = "youko";
|
||||
labels.env = "homelab";
|
||||
labels.cluster = "homelab";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
job_name = "v2ray-exporter";
|
||||
scrape_interval = "30s";
|
||||
|
||||
Reference in new issue
Block a user