about summary refs log tree commit diff
path: root/users/glittershark/system
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-03-28T23·55-0400
committerglittershark <grfn@gws.fyi>2021-03-29T00·00+0000
commit945675b3f550b15b41a638648c2f531888564c60 (patch)
tree443ffa602430c3384bfbe9c47b3558660ca8f431 /users/glittershark/system
parentb6f88fb4cdcb6604a94b02a960d25017b74d1b13 (diff)
feat(gs/mugwump): Add blackbox prometheus exporters r/2363
Add blackbox prometheus exporters to Mugwump with config for scraping
gws.fyi, windtunnel.ci, and app.windtunnel.ci

Change-Id: Ied9e329d44b506763b600e4978f65a5a3abcf5df
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2702
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/glittershark/system')
-rw-r--r--users/glittershark/system/system/machines/mugwump.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/users/glittershark/system/system/machines/mugwump.nix b/users/glittershark/system/system/machines/mugwump.nix
index 64ee36ca72f3..22d9e7cd06bd 100644
--- a/users/glittershark/system/system/machines/mugwump.nix
+++ b/users/glittershark/system/system/machines/mugwump.nix
@@ -146,6 +146,24 @@ with lib;
         sslVerify = false;
         constLabels = [ "host=mugwump" ];
       };
+
+      blackbox = {
+        enable = true;
+        openFirewall = true;
+        configFile = pkgs.writeText "blackbox-exporter.yaml" (builtins.toJSON {
+          modules = {
+            https_2xx = {
+              prober = "http";
+              http = {
+                method = "GET";
+                fail_if_ssl = false;
+                fail_if_not_ssl = true;
+                preferred_ip_protocol = "ip4";
+              };
+            };
+          };
+        });
+      };
     };
 
     scrapeConfigs = [{
@@ -160,6 +178,28 @@ with lib;
       static_configs = [{
         targets = ["localhost:${toString config.services.prometheus.exporters.nginx.port}"];
       }];
+    } {
+      job_name = "blackbox";
+      metrics_path = "/probe";
+      params.module = ["https_2xx"];
+      scrape_interval = "5s";
+      static_configs = [{
+        targets = [
+          "https://www.gws.fyi"
+          "https://windtunnel.ci"
+          "https://app.windtunnel.ci"
+        ];
+      }];
+      relabel_configs = [{
+        source_labels = ["__address__"];
+        target_label = "__param_target";
+      } {
+        source_labels = ["__param_target"];
+        target_label = "instance";
+      } {
+        target_label = "__address__";
+        replacement = "localhost:${toString config.services.prometheus.exporters.blackbox.port}";
+      }];
     }];
   };