diff options
| author | seth <[email protected]> | 2023-05-21 13:46:48 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-05-21 13:46:48 -0400 |
| commit | 7033360450cd03c20ea65536a18c1f9c7ba240cf (patch) | |
| tree | 1e45292c8a148c2944641421cc867e3bfc5e39a6 | |
| parent | c6b38fd8f0e5908e5593d33e66cae8980f560c1b (diff) | |
atlas: share metrics with p-body
| -rw-r--r-- | hosts/atlas/default.nix | 1 | ||||
| -rw-r--r-- | hosts/atlas/prometheus.nix | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/hosts/atlas/default.nix b/hosts/atlas/default.nix index 6380d14..50fa986 100644 --- a/hosts/atlas/default.nix +++ b/hosts/atlas/default.nix @@ -5,6 +5,7 @@ }: { imports = [ ./hardware-configuration.nix + ./prometheus.nix ]; _module.args.nixinate = { diff --git a/hosts/atlas/prometheus.nix b/hosts/atlas/prometheus.nix new file mode 100644 index 0000000..b0c3f7b --- /dev/null +++ b/hosts/atlas/prometheus.nix @@ -0,0 +1,33 @@ +{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 "atlas" "127.0.0.1" "${toString config.services.prometheus.exporters.node.port}") + ]; + }; + + getchoo.server.services.promtail.clients = [ + { + url = "p-body:3030/loki/api/v1/push"; + } + ]; +} |
