Expose traefik metrics to prometheus.

This commit is contained in:
♥ Minnie ♥ 2024-06-06 20:45:31 +08:00
parent 45d22ff08c
commit 4bd78856e7
Signed by: jasmine
GPG key ID: 8563E358D4E8040E

View file

@ -89,6 +89,21 @@
]; ];
}; };
}; };
# Used to expose metrics
metrics = {
address = ":8082";
};
};
# Provide metrics for the prometheus backend
metrics = {
prometheus = {
entryPoint = "metrics";
buckets = [ "0.1" "0.3" "1.2" "5.0" ];
addEntryPointsLabels = true;
addRoutersLabels = true;
addServicesLabels = true;
};
}; };
# Retrieve certificates from an ACME server # Retrieve certificates from an ACME server
@ -118,6 +133,16 @@
}; };
}; };
# Scrape our traefik metrics
services.prometheus.scrapeConfigs = [
{
job_name = "traefik";
static_configs = [{
targets = [ "127.0.0.1:8082" ];
}];
}
];
# Persist our traefik data & logs # Persist our traefik data & logs
environment.persistence."/persist" = { environment.persistence."/persist" = {
directories = [ directories = [