cluster/services/monitoring: provision dashboards
This commit is contained in:
parent
a4888920df
commit
4dbfb3b6ab
2 changed files with 25 additions and 0 deletions
|
@ -35,6 +35,7 @@ in
|
||||||
server = [
|
server = [
|
||||||
./server.nix
|
./server.nix
|
||||||
./tracing.nix
|
./tracing.nix
|
||||||
|
./provisioning/dashboards.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
24
cluster/services/monitoring/provisioning/dashboards.nix
Normal file
24
cluster/services/monitoring/provisioning/dashboards.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue