cluster/services/monitoring: provision dashboards

This commit is contained in:
Max Headroom 2023-06-01 00:12:31 +02:00
parent a4888920df
commit 4dbfb3b6ab
2 changed files with 25 additions and 0 deletions

View file

@ -35,6 +35,7 @@ in
server = [ server = [
./server.nix ./server.nix
./tracing.nix ./tracing.nix
./provisioning/dashboards.nix
]; ];
}; };
}; };

View file

@ -0,0 +1,24 @@
{ lib, pkgs, ... }:
let
loadDashboard = file: lib.pipe file [
lib.importJSON
({ dashboard, ... }: rec {
name = "provision-dashboard-${dashboard.uid}.json";
path = builtins.toFile name (builtins.toJSON dashboard);
})
];
dashboardsDir = pkgs.linkFarm
"grafana-provisioning-dashboards"
(map loadDashboard (lib.filesystem.listFilesRecursive ./objects/dashboards));
in
{
services.grafana.provision.dashboards.settings = {
providers = lib.singleton {
options.path = dashboardsDir;
allowUiUpdates = true;
};
};
}