refactor: grafana - add more datasources, rewrite in nix

This commit is contained in:
Ryan Yin
2025-09-26 22:07:52 +08:00
parent 935a1dccda
commit 7885d10e29
6 changed files with 174 additions and 97 deletions
+7 -10
View File
@@ -5,10 +5,16 @@
...
}:
{
imports = [
./dashboards.nix
./datasources.nix
];
services.grafana = {
enable = true;
dataDir = "/data/apps/grafana";
# DeclarativePlugins = with pkgs.grafanaPlugins; [ grafana-piechart-panel ];
provision.enable = true;
settings = {
server = {
http_addr = "127.0.0.1";
@@ -41,15 +47,6 @@
};
};
# Declaratively provision Grafana's data sources, dashboards, and alerting rules.
# Grafana's alerting rules is not recommended to use, we use Prometheus alertmanager instead.
# https://grafana.com/docs/grafana/latest/administration/provisioning/#data-sources
provision = {
enable = true;
datasources.path = ./datasources.yml;
dashboards.path = ./dashboards.yml;
};
# https://github.com/NixOS/nixpkgs/tree/master/pkgs/servers/monitoring/grafana/plugins
declarativePlugins = with pkgs.grafanaPlugins; [
# https://github.com/VictoriaMetrics/victoriametrics-datasource