about summary refs log tree commit diff
path: root/modules/nixos/monitoring/default.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-05-21 23:10:32 +0300
committerAzat Bahawi <azat@bahawi.net>2023-05-21 23:10:32 +0300
commitb07e10139c88d6060e57ca52b2dc12b17b53ac82 (patch)
tree5b5cddc2f47bddb8e8914aa66ae18d52cd519965 /modules/nixos/monitoring/default.nix
parent2023-05-06 (diff)
2023-05-21
Diffstat (limited to 'modules/nixos/monitoring/default.nix')
-rw-r--r--modules/nixos/monitoring/default.nix18
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/nixos/monitoring/default.nix b/modules/nixos/monitoring/default.nix
index 37e34d9..7f62874 100644
--- a/modules/nixos/monitoring/default.nix
+++ b/modules/nixos/monitoring/default.nix
@@ -122,8 +122,6 @@ in {
       loki.configuration.ruler.alertmanager_url = "https://${config.nixfiles.modules.alertmanager.domain}";
 
       prometheus = {
-        # It would be nice if these could be generated dynamically. That would
-        # require a complete rework of how configurations are defined, though.
         scrapeConfigs = with my.configurations;
           mapAttrsToList
           (
@@ -144,13 +142,15 @@ in {
                     hosts;
                 }
               ];
-              relabel_configs = [
-                {
-                  source_labels = ["__address__"];
-                  regex = "([^:]+):\\d+";
-                  target_label = "instance";
-                }
-              ];
+              relabel_configs =
+                [
+                  {
+                    source_labels = ["__address__"];
+                    regex = "([^:]+):\\d+";
+                    target_label = "instance";
+                  }
+                ]
+                ++ optionals (hasAttr "relabel" value) value.relabel;
             }
           )
           {

Consider giving Nix/NixOS a try! <3