service/loki: add dashboard

This commit is contained in:
Felix Buehler 2023-04-13 21:53:52 +02:00
parent 95394f8881
commit e9852f6c58
2 changed files with 39 additions and 8 deletions

View file

@ -50,7 +50,8 @@ in
}; };
}; };
services.grafana.provision.datasources.settings.datasources = [ services.grafana.provision = {
datasources.settings.datasources = [
{ {
name = "Loki"; name = "Loki";
type = "loki"; type = "loki";
@ -58,5 +59,28 @@ in
url = "http://localhost:${toString cfg.port}"; url = "http://localhost:${toString cfg.port}";
} }
]; ];
dashboards.settings.providers = [
{
name = "Loki";
options.path = pkgs.grafana-dashboards.loki;
disableDeletion = true;
}
];
};
services.prometheus = {
scrapeConfigs = [
{
job_name = "loki";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};
}
];
}
];
};
}; };
} }

View file

@ -47,4 +47,11 @@ in
# version = "1"; # version = "1";
# hash = "sha256-MU890UAEI9wrnVIC/R0HkYwFa6mJ8Y7ESAWuaSQ8FQ8="; # hash = "sha256-MU890UAEI9wrnVIC/R0HkYwFa6mJ8Y7ESAWuaSQ8FQ8=";
# }; # };
loki = buildGrafanaDashboard {
id = 14055;
pname = "loki";
version = "5";
hash = "sha256-9vfUGpypFNKm9T1F12Cqh8TIl0x3jSwv2fL9HVRLt3o=";
};
}) })