Enable Prometheus/Grafana/Loki
All checks were successful
/ test (push) Successful in 1m35s

This commit is contained in:
Andrea Ciceri 2024-07-21 18:18:24 +02:00
parent ebc446116c
commit 7f52ad42cd
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg
14 changed files with 290 additions and 2 deletions

View file

@ -0,0 +1,33 @@
{config, ...}: let
cfg = config.services.prometheus;
in {
services.prometheus = {
enable = true;
checkConfig = false; # Otherwise it will fail because it cannot access bearer_token_file
webExternalUrl = "https://status.aciceri.dev";
globalConfig.scrape_interval = "10s";
scrapeConfigs = [
{
job_name = "hass";
metrics_path = "/api/prometheus";
bearer_token_file = config.age.secrets.home-assistant-token.path;
static_configs = [
{
targets = ["sisko.fleet:${builtins.toString config.services.home-assistant.config.http.server_port}"];
}
];
}
{
job_name = "node";
static_configs = [
{
targets = builtins.map (host: "${host}.fleet:9100") ["sisko" "picard"];
}
];
}
];
};
environment.persistence."/persist".directories = [
"/var/lib/${cfg.stateDir}"
];
}