Skip to content
Snippets Groups Projects
blackbox.nix 892 B
Newer Older
  • Learn to ignore specific revisions
  • # Prometheus Blackbox exporter configuration
    
    # Scope: From the monitoring machine, ping (etc.) hosts to check whether
    
    #        they are reachable, certs still are valid for a while, etc.
    #
    
    # Notes: The Blackbox exporter is using the "Multi Target Exporter" pattern,
    
    #        see https://prometheus.io/docs/guides/multi-target-exporter/ .
    #
    # Usage: Import this on a monitoring server
    
    
    { config, lib, pkgs, ... }: {
    
      config.services.prometheus.exporters.blackbox = {
        enable = true;
    
        configFile = pkgs.writeText "blackbox-exporter.yaml" (builtins.toJSON {
          modules = {
            https_2xx = {
              prober = "http";
              timeout = "5s";
              http = {
                fail_if_not_ssl = true;
                # This prober is for IPv4 only.
                preferred_ip_protocol = "ip4";
                ip_protocol_fallback = false;
              };
            };
          };
        });
    
      };
    }