summary refs log tree commit diff
path: root/modules/monitoring/module.nix
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-09-02 20:19:00 +0200
committerRory& <root@rory.gay>2024-09-02 20:19:00 +0200
commita693745b35f7c534248e6ff0b00e9639c04ba39a (patch)
tree70b5583276729cc851e72bedb1753c1e11a11b8e /modules/monitoring/module.nix
parentfix prom (diff)
downloadRory-Open-Architecture-a693745b35f7c534248e6ff0b00e9639c04ba39a.tar.xz
Single scrape interval, add synapse label
Diffstat (limited to 'modules/monitoring/module.nix')
-rw-r--r--modules/monitoring/module.nix50
1 files changed, 20 insertions, 30 deletions
diff --git a/modules/monitoring/module.nix b/modules/monitoring/module.nix
index 30c313b..62ff1ea 100644
--- a/modules/monitoring/module.nix
+++ b/modules/monitoring/module.nix
@@ -13,7 +13,7 @@ in
   imports = [
     # crutches due to nix limitations:
     ./crutches/synapse.nix
-    
+
     # modules
     ./system.nix
     ./postgres.nix
@@ -28,15 +28,10 @@ in
 
     nginxHost = mkStringOption "The virtual host name";
     nginxSsl = lib.mkEnableOption "Enable SSL for Nginx";
-    prometheusScrapeIntervals = lib.mkOption {
-      type = lib.types.listOf lib.types.int;
-      default = [
-        1
-        #2 # kinda pointless?
-        #5 # doesnt help with reliability
-        #15 # might aswell just use a 15s interval on grafana
-      ];
-      description = "Scrape intervals for Prometheus";
+    prometheusScrapeInterval = lib.mkOption {
+      type = lib.types.int;
+      default = 1;
+      description = "Scrape interval for Prometheus";
     };
   };
 
@@ -45,9 +40,7 @@ in
       prometheus = lib.mkIf (cfg.localPrometheus) {
         enable = true;
         listenAddress = "127.0.0.1";
-        extraFlags = [
-          "--storage.tsdb.wal-compression"
-        ];
+        extraFlags = [ "--storage.tsdb.wal-compression" ];
       };
       grafana = lib.mkIf (cfg.localGrafana) {
         enable = true;
@@ -62,24 +55,21 @@ in
         provision = {
           datasources.settings = {
             apiVersion = 1;
-            #            datasources = [
-            #              {
-            #                name = "Prometheus";
-            #                type = "prometheus";
-            #                access = "proxy";
-            #                url = "http://127.0.0.1:${toString config.services.prometheus.port}";
-            #                isDefault = true;
-            #              }
-            #            ];
 
-            datasources = lib.map (interval: {
-              name = "Prometheus-${toString interval}";
-              type = "prometheus";
-              access = "proxy";
-              url = "http://127.0.0.1:${toString config.services.prometheus.port}";
-              #isDefault = true;
-              jsonData.timeInterval = "${toString interval}s";
-            }) cfg.prometheusScrapeIntervals;
+            datasources =
+              lib.map
+                (interval: {
+                  name = "Prometheus-${toString interval}";
+                  type = "prometheus";
+                  access = "proxy";
+                  url = "http://127.0.0.1:${toString config.services.prometheus.port}";
+                  #isDefault = true;
+                  jsonData.timeInterval = "${toString interval}s";
+                })
+                [
+                  1
+                  15
+                ];
           };
         };
       };