summaryrefslogtreecommitdiffstats
path: root/usecases/server/monitoring-server.nix
blob: 99afafb5016ea622602af1f6a27a5cafd8a78e1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
inputs:

{ config, ... }:

{
  services.prometheus = {
    enable = true;

    listenAddress = "127.0.0.1";

    retentionTime = "15w";

    scrapeConfigs = [
      {
        job_name = "prometheus";
        static_configs = [
          { targets = [ "localhost:${toString config.services.prometheus.port}" ]; }
        ];
      }

      {
        job_name = "grafana";
        static_configs = [
          { targets = [ "localhost:${toString config.services.grafana.port}" ]; }
        ];
      }
    ];
  };

  services.grafana = {
    enable = true;

    addr = config.topology.mainVpn.currentNodeIP;
    port = 3001;

    analytics.reporting.enable = false;
  };

  services.grafana-image-renderer = {
    enable = true;
    provisionGrafana = true;
    settings.service.port = 2173;
  };

  networking.firewall.interfaces.${config.topology.mainVpn.interfaceName}.allowedTCPPorts = [
    config.services.grafana.port
  ];
}