From 7033360450cd03c20ea65536a18c1f9c7ba240cf Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 21 May 2023 13:46:48 -0400 Subject: atlas: share metrics with p-body --- hosts/atlas/default.nix | 1 + hosts/atlas/prometheus.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 hosts/atlas/prometheus.nix (limited to 'hosts') 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"; + } + ]; +} -- cgit v1.2.3