aboutsummaryrefslogtreecommitdiffstats
path: root/modules/common.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/common.nix')
-rw-r--r--modules/common.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/modules/common.nix b/modules/common.nix
new file mode 100644
index 0000000..480aa62
--- /dev/null
+++ b/modules/common.nix
@@ -0,0 +1,46 @@
+# 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.
+ '';
+
+ grafana = portOption 3000 ''
+ Port Grafana listens on. If the reverse proxy is enabled this stays internal and
+ the proxy is what you connect to.
+ '';
+ };
+}