about summary refs log tree commit diff
path: root/modules/services
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/services/grafana/dashboards/fly-app_rev1.json (renamed from hosts/common/server/dashboards/fly-app_rev1.json)0
-rw-r--r--modules/services/grafana/dashboards/nas.json (renamed from hosts/common/server/dashboards/nas.json)0
-rw-r--r--modules/services/grafana/dashboards/node-exporter.json (renamed from hosts/common/server/dashboards/node-exporter.json)0
-rw-r--r--modules/services/grafana/dashboards/rtr.json (renamed from hosts/common/server/dashboards/rtr.json)0
-rw-r--r--modules/services/grafana/dashboards/traefik_rev5.json (renamed from hosts/common/server/dashboards/traefik_rev5.json)0
-rw-r--r--modules/services/grafana/default.nix47
6 files changed, 47 insertions, 0 deletions
diff --git a/hosts/common/server/dashboards/fly-app_rev1.json b/modules/services/grafana/dashboards/fly-app_rev1.json
index 5894078..5894078 100644
--- a/hosts/common/server/dashboards/fly-app_rev1.json
+++ b/modules/services/grafana/dashboards/fly-app_rev1.json
diff --git a/hosts/common/server/dashboards/nas.json b/modules/services/grafana/dashboards/nas.json
index 61daa3b..61daa3b 100644
--- a/hosts/common/server/dashboards/nas.json
+++ b/modules/services/grafana/dashboards/nas.json
diff --git a/hosts/common/server/dashboards/node-exporter.json b/modules/services/grafana/dashboards/node-exporter.json
index 44356fa..44356fa 100644
--- a/hosts/common/server/dashboards/node-exporter.json
+++ b/modules/services/grafana/dashboards/node-exporter.json
diff --git a/hosts/common/server/dashboards/rtr.json b/modules/services/grafana/dashboards/rtr.json
index 75f1598..75f1598 100644
--- a/hosts/common/server/dashboards/rtr.json
+++ b/modules/services/grafana/dashboards/rtr.json
diff --git a/hosts/common/server/dashboards/traefik_rev5.json b/modules/services/grafana/dashboards/traefik_rev5.json
index b39b8c5..b39b8c5 100644
--- a/hosts/common/server/dashboards/traefik_rev5.json
+++ b/modules/services/grafana/dashboards/traefik_rev5.json
diff --git a/modules/services/grafana/default.nix b/modules/services/grafana/default.nix
new file mode 100644
index 0000000..5d67bc1
--- /dev/null
+++ b/modules/services/grafana/default.nix
@@ -0,0 +1,47 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.services.grafana;
+in {
+  options.my.services.grafana = with lib; {
+    enable = mkEnableOption "grafana observability stack";
+  };
+
+  config = lib.mkIf cfg.enable {
+    services.grafana = {
+      enable = true;
+      # Bind to all interfaces.
+      addr = "";
+      security.adminUser = "fcuny";
+
+      analytics.reporting.enable = false;
+
+      provision = {
+        enable = true;
+        datasources = [{
+          name = "prometheus";
+          type = "prometheus";
+          isDefault = true;
+          url = "http://localhost:9090";
+        }];
+        dashboards = [{
+          disableDeletion = true;
+          options.path = ./dashboards;
+        }];
+      };
+    };
+
+    age.secrets.restic-repo-systems.file =
+      ../../../secrets/restic/repo-systems.age;
+
+    services.restic.backups = {
+      grafana = {
+        paths = [ "/var/lib/grafana/data" ];
+        repository = "/data/slow/backups/systems";
+        passwordFile = config.age.secrets.restic-repo-systems.path;
+        timerConfig = { OnCalendar = "00:05"; };
+        initialize = true;
+        extraBackupArgs = [ "--tag grafana" ];
+        pruneOpts = [ "--keep-daily 7" "--keep-weekly 4" ];
+      };
+    };
+  };
+}