add caddy metrics

This commit is contained in:
Henry Hiles 2025-12-31 18:19:18 -05:00
commit aff7879923
No known key found for this signature in database
3 changed files with 40 additions and 25 deletions

View file

@ -61,6 +61,25 @@ in
hash = "sha256-pNgn6xgZBEu6LW0lc0cXX2gRkQ8lg/rer34SPE3yEl4="; hash = "sha256-pNgn6xgZBEu6LW0lc0cXX2gRkQ8lg/rer34SPE3yEl4=";
}; };
} }
{
name = "Caddy Hosts";
options.path = pkgs.stdenv.mkDerivation {
pname = "caddy-hosts-json";
version = "1.0.0";
dontUnpack = true;
src = pkgs.fetchurl {
name = "caddy-hosts.json";
url = "https://grafana.com/api/dashboards/24146/revisions/1/download";
hash = "sha256-vw/O3bNKQ0tJwhsZKYvkMU6jeqkG+sfCtA7YT0vp3YY=";
};
installPhase = ''
mkdir -p $out
sed 's|''${DS_PROMETHEUS}|prometheus|g' $src > $out/caddy-exporter.json
'';
};
}
]; ];
}; };
}; };

View file

@ -16,33 +16,23 @@
} }
]; ];
} }
{
job_name = "caddy";
static_configs = [
{ targets = [ "localhost:2019" ]; }
];
}
]; ];
exporters.node = { exporters = {
enable = true; node = {
listenAddress = "127.0.0.3"; enable = true;
enabledCollectors = [ listenAddress = "127.0.0.3";
"systemd" enabledCollectors = [
"processes" "systemd"
]; "processes"
# disabledCollectors = [ ];
# "arp" };
# "bcache"
# "bonding"
# "btrfs"
# "conntrack"
# "dmi"
# "edac"
# "entropy"
# "exec"
# "fibrechannel"
# "filefd"
# "hwmon"
# "infiniband"
# "ipvs"
# "mdadm"
# "netclass"
# ];
}; };
}; };
} }

View file

@ -25,6 +25,12 @@
hash = "sha256-t1qQtYpBKCWeHV8ML200LzB+Sc8iAGl2kc9pvOCKdac="; hash = "sha256-t1qQtYpBKCWeHV8ML200LzB+Sc8iAGl2kc9pvOCKdac=";
}; };
globalConfig = ''
metrics {
per_host
}
'';
virtualHosts = lib.mapAttrs (domain: host: { virtualHosts = lib.mapAttrs (domain: host: {
extraConfig = extraConfig =
let let