Skip to content
Snippets Groups Projects
Select Git revision
  • 22679e83235bb5264f2ce63dc77a7bd98de9ef3a
  • develop default protected
  • dont-use-etc-hosts
  • sec
  • simplify-grafana
  • simple-docs-build
  • local-test-grid
  • no-morph-on-nodes
  • stuff
  • arion
10 results

customize-monitoring.nix

Blame
  • Forked from PrivateStorage / PrivateStorageio
    1250 commits behind the upstream repository.
    customize-monitoring.nix 1.53 KiB
    # Define a function which returns a value which fills in all the holes left by
    # ``monitoring.nix``.
    {
      # A set mapping VPN IP addresses as strings to lists of hostnames as
      # strings.  The system's ``/etc/hosts`` will be populated with this
      # information.  Apart from helping with normal forward resolution, this
      # *also* gives us reverse resolution from the VPN IPs to hostnames which
      # allows Grafana to show us hostnames instead of VPN IP addresses.
      hostsMap
    
      # See ``customize-issuer.nix``.
    , monitoringvpnKeyDir
    , monitoringvpnIPv4
    
      # XXX To be removed
    , publicIPv4
    
      # A list of VPN IP addresses as strings indicating which clients will be
      # allowed onto the VPN.
    , vpnClientIPs
    
      # A list of VPN clients (IP addresses or hostnames) as strings indicating
      # which nodes to scrape metrics from.
    , nodeExporterTargets
    
      # ...
    , nginxExporterTargets ? []
    
      # A string giving the NixOS state version for the system.
    , stateVersion
    , ...
    }: {
      deployment.targetHost = publicIPv4;
      deployment.secrets = {
        "monitoringvpn-private-key".source = "${monitoringvpnKeyDir}/server.key";
        "monitoringvpn-preshared-key".source = "${monitoringvpnKeyDir}/preshared.key";
      };
      networking.hosts = hostsMap;
    
      services.private-storage.monitoring.vpn.server = {
        enable = true;
        ip = monitoringvpnIPv4;
        inherit vpnClientIPs;
        pubKeysPath = monitoringvpnKeyDir;
      };
    
      services.private-storage.monitoring.prometheus = {
        inherit nodeExporterTargets;
        inherit nginxExporterTargets;
      };
    
      system.stateVersion = stateVersion;
    }