summaryrefslogtreecommitdiff
path: root/hosts/p-body/prometheus.nix
blob: 56e05a9d5a09a15cdfa22cd7aca1eaf3fc454ea3 (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
{config, ...}: let
  scrapeExporter = name: host: port: {
    job_name = "${name}";
    static_configs = [
      {
        targets = [
          "${host}:${port}"
        ];
      }
    ];
  };
in {
  services.prometheus = {
    enable = true;
    port = 5000;
    exporters = {
      node = {
        enable = true;
        enabledCollectors = ["systemd"];
        port = 5001;
      };
    };
    scrapeConfigs = [
      (scrapeExporter "p-body" "127.0.0.1" "${toString config.services.prometheus.exporters.node.port}")
      (scrapeExporter "atlas" "atlas" "5001")
    ];
  };

  getchoo.server.services.promtail.clients = [
    {
      url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
    }
  ];
}