netdata metrics with basic auth

seems to have performance problems with caddy
This commit is contained in:
Noah Masur
2022-10-10 18:11:08 +00:00
parent 170f8c67de
commit a5e186ee87
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,43 @@
{ config, lib, ... }: {
options = {
metricsServer = lib.mkOption {
type = lib.types.str;
description = "Hostname for Metrics server";
};
metricsPasswordHashed = lib.mkOption {
type = lib.types.str;
description = "Metrics password hashed with `caddy hash-password`";
};
};
imports = [ ./caddy.nix ];
config = {
services.netdata.enable = true;
caddyRoutes = [{
match = [{ host = [ config.metricsServer ]; }];
handle = [
{
handler = "authentication";
providers = {
http_basic = {
accounts = [{
username = config.user;
password = config.metricsPasswordHashed;
}];
};
};
}
{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:19999"; }];
}
];
}];
};
}