about summary refs log tree commit diff
path: root/modules/nixos/monitoring/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-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