aboutsummaryrefslogtreecommitdiffstats
path: root/modules/common.nix
blob: fd343de85a81613e50fb17d83d3cec4eb3c89d6e (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
49
50
51
# Options both halves need to agree on.
#
# The collectors bind these ports; the server scrapes them and pushes to them. When the
# two halves live in separate NixOS configurations (host + container) there is no shared
# `config` to read, so each side sets its own copy and it is on you to keep them equal —
# which is why they are gathered in one small file rather than scattered.
#
# Imported by both modules/collectors.nix and modules/server.nix. Importing the same
# path twice is harmless: the module system deduplicates imports by path, so a
# configuration that uses both halves does not end up declaring these twice.
{ lib, ... }:

let
  inherit (lib) mkOption types;

  portOption = default: description: mkOption {
    inherit default description;
    type = types.port;
  };
in
{
  options.services.telemetry.ports = {
    node = portOption 9100 ''
      Port the Prometheus node exporter listens on. Also where the server's `node`
      scrape job points.
    '';

    smartctl = portOption 9633 ''
      Port the smartctl exporter listens on. Also where the server's `smartctl` scrape
      job points.
    '';

    loki = portOption 3100 ''
      Port Loki listens on. Also where the collectors' log shipper pushes to.
    '';

    prometheus = portOption 9090 ''
      Port Prometheus listens on.
    '';

    alertmanager = portOption 9093 ''
      Port Alertmanager listens on. Only Prometheus talks to it, but the web UI is
      where you silence alerts.
    '';

    grafana = portOption 3000 ''
      Port Grafana listens on. If the reverse proxy is enabled this stays internal and
      the proxy is what you connect to.
    '';
  };
}