[metrics] Gets Loki and Prometheus set up with Grafana

This commit is contained in:
2025-03-22 11:31:35 -07:00
parent 8833323b82
commit 55557f4fed
4 changed files with 48 additions and 5 deletions

View File

@@ -10,8 +10,10 @@ in {
image = "grafana/grafana-enterprise";
dependsOn = [
"db"
"loki"
];
hostName = "grafana";
domain = lib.blazestar;
port = 3000;
homepageOpts = {
group = "Infra";
@@ -23,7 +25,42 @@ in {
"grafana-storage:/var/lib/grafana"
];
environment = {
GF_SERVER_ROOT_URL = "https://grafna.havenisms.com";
GF_SERVER_ROOT_URL = "https://grafana.${lib.blazestar}";
};
};
virtualisation.oci-containers.containers.loki = lib.mkContainer {
image = "grafana/loki";
hostName = "loki";
domain = lib.blazestar;
port = 3100;
homepageOpts = {
group = "Infra";
icon = "loki.png";
name = "Loki";
description = "Log Database";
};
environment = {};
};
services.promtail = {
enable = true;
configuration = {
server.http_listen_port = 9080;
clients = [
{ url = "https://loki.blazestar.net/loki/api/v1/push"; }
];
scrape_configs = [{
job_name = "journal";
journal = {
max_age = "12h";
labels = { job = "systemd-journal"; };
};
relabel_configs = [{
source_labels = ["__journal__systemd_unit"];
target_label = "unit";
}];
}];
};
};
}