diff --git a/nixos/machines/chungus/configuration.nix b/nixos/machines/chungus/configuration.nix index 6f4a2ab..53e01f4 100644 --- a/nixos/machines/chungus/configuration.nix +++ b/nixos/machines/chungus/configuration.nix @@ -37,10 +37,12 @@ # logging ./loki.nix ./loki-promtail.nix - ./prometheus.nix ./grafana.nix - ./telegraf.nix - ./telegraf-smart.nix + + ./telemetry/opentelemetry.nix + ./telemetry/prometheus.nix + ./telemetry/telegraf.nix + ./telemetry/telegraf-smart.nix #./home-display.nix diff --git a/nixos/machines/chungus/telemetry/opentelemetry.nix b/nixos/machines/chungus/telemetry/opentelemetry.nix new file mode 100644 index 0000000..85a0775 --- /dev/null +++ b/nixos/machines/chungus/telemetry/opentelemetry.nix @@ -0,0 +1,58 @@ +{ pkgs, ... }: +{ + services.opentelemetry-collector = { + enable = true; + package = pkgs.unstable.opentelemetry-collector-contrib; + settings = { + receivers = { + + # receive metrics from other open telemetry collectors + otlp.protocols.grpc.endpoint = "0.0.0.0:4317"; + + # provide a influxdb sink + influxdb = { + endpoint = "127.0.0.1:8088"; + }; + + # scrape opentelemetry-colectors metrics + prometheus.config.scrape_configs = [ + { + job_name = "netdata"; + scrape_interval = "10s"; + metrics_path = "/api/v1/allmetrics"; + params.format = [ "prometheus" ]; + static_configs = [{ targets = [ "127.0.0.1:19999" ]; }]; + } + { + job_name = "otelcol"; + scrape_interval = "10s"; + static_configs = [{ targets = [ "127.0.0.1:8100" ]; }]; + metric_relabel_configs = [ + { + source_labels = [ "__name__" ]; + regex = ".*grpc_io.*"; + action = "drop"; + } + ]; + } + ]; + }; + + exporters = { + # provide prometheus sink under `/metrics` to + prometheus = { + endpoint = "127.0.0.1:8090"; + }; + }; + + service = { + pipelines.metrics = { + receivers = [ "otlp" "influxdb" "prometheus" ]; + exporters = [ "prometheus" ]; + }; + # open telemetries own metrics? + telemetry.metrics.address = "0.0.0.0:8100"; + }; + }; + }; +} diff --git a/nixos/machines/chungus/prometheus.nix b/nixos/machines/chungus/telemetry/prometheus.nix similarity index 97% rename from nixos/machines/chungus/prometheus.nix rename to nixos/machines/chungus/telemetry/prometheus.nix index 5d2fc32..43a469e 100644 --- a/nixos/machines/chungus/prometheus.nix +++ b/nixos/machines/chungus/telemetry/prometheus.nix @@ -59,15 +59,6 @@ })) ]; - - - - #alertmanager = { - # enable = true; - # configuration = { - #}; - #}; - exporters = { node = { enable = true; diff --git a/nixos/machines/chungus/telegraf-smart.nix b/nixos/machines/chungus/telemetry/telegraf-smart.nix similarity index 100% rename from nixos/machines/chungus/telegraf-smart.nix rename to nixos/machines/chungus/telemetry/telegraf-smart.nix diff --git a/nixos/machines/chungus/telegraf.nix b/nixos/machines/chungus/telemetry/telegraf.nix similarity index 100% rename from nixos/machines/chungus/telegraf.nix rename to nixos/machines/chungus/telemetry/telegraf.nix diff --git a/nixos/machines/orbi/configuration.nix b/nixos/machines/orbi/configuration.nix index 884718f..e2f46b6 100644 --- a/nixos/machines/orbi/configuration.nix +++ b/nixos/machines/orbi/configuration.nix @@ -41,9 +41,9 @@ #./loki.nix #./loki-promtail.nix #./grafana.nix - ./system-telegraf.nix - ./system-opentelemetry.nix - #./system-prometheus.nix + ./telemetry/telegraf.nix + ./telemetry/opentelemetry.nix + #./telemetry/prometheus.nix #./cache.nix ]; diff --git a/nixos/machines/orbi/system-opentelemetry.nix b/nixos/machines/orbi/telemetry/opentelemetry.nix similarity index 100% rename from nixos/machines/orbi/system-opentelemetry.nix rename to nixos/machines/orbi/telemetry/opentelemetry.nix diff --git a/nixos/machines/orbi/system-prometheus.nix b/nixos/machines/orbi/telemetry/system-prometheus.nix similarity index 100% rename from nixos/machines/orbi/system-prometheus.nix rename to nixos/machines/orbi/telemetry/system-prometheus.nix diff --git a/nixos/machines/orbi/system-telegraf.nix b/nixos/machines/orbi/telemetry/telegraf.nix similarity index 100% rename from nixos/machines/orbi/system-telegraf.nix rename to nixos/machines/orbi/telemetry/telegraf.nix