nix-infra/config/hosts/metrics/prometheus.nix

36 lines
999 B
Nix

{ hosts, pkgs, ... }:
let
# https://github.com/element-hq/synapse/tree/master/contrib/prometheus/
synapseRules = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/element-hq/synapse/refs/heads/master/contrib/prometheus/synapse-v2.rules";
hash = "sha256-WldlBdCMzul49OlFhJMsrx4MYFakHTa36Y9HnV22EwI=";
};
in
{
services.prometheus = {
enable = true;
retentionTime = "90d";
ruleFiles = [ synapseRules ];
scrapeConfigs = [
{
job_name = "node";
static_configs = builtins.map (name: {
targets = [
"${name}.${hosts.${name}.site}.grzb.de:9100"
];
labels = {
host = "${name}.${hosts.${name}.site}.grzb.de";
};
}) (builtins.attrNames hosts);
}
{
job_name = "synapse";
scrape_interval = "15s";
metrics_path = "/_synapse/metrics";
static_configs = [{
targets = [ "matrix.vs.grzb.de:9000" ];
}];
}
];
};
}