From 1753f97e133b00097bec72b5666105d088c2f645 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 20 Dec 2021 10:29:13 -0500 Subject: [PATCH 1/3] services.prometheus.exporters.fastly: fixup broken module config --- .../services/monitoring/prometheus/exporters/fastly.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/monitoring/prometheus/exporters/fastly.nix b/nixos/modules/services/monitoring/prometheus/exporters/fastly.nix index 5b35bb29a301..551c61ba9e44 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/fastly.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/fastly.nix @@ -32,10 +32,10 @@ in script = '' ${optionalString (cfg.tokenPath != null) "export FASTLY_API_TOKEN=$(cat ${toString cfg.tokenPath})"} - ${pkgs.fastly-exporter}/bin/fastly-exporter \ - -endpoint http://${cfg.listenAddress}:${cfg.port}/metrics + ${pkgs.prometheus-fastly-exporter}/bin/fastly-exporter \ + -endpoint http://${cfg.listenAddress}:${toString cfg.port}/metrics ${optionalString cfg.debug "-debug true"} \ - ${optionalString cfg.configFile "-config-file ${cfg.configFile}"} + ${optionalString (cfg.configFile != null) "-config-file ${cfg.configFile}"} ''; }; } From d3aee09b992c25f4788ca00e4654d055c0e553ac Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 20 Dec 2021 10:50:29 -0500 Subject: [PATCH 2/3] prometheus-fastly-exporter: 6.1.0 -> 7.0.1 --- pkgs/servers/monitoring/prometheus/fastly-exporter.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/monitoring/prometheus/fastly-exporter.nix b/pkgs/servers/monitoring/prometheus/fastly-exporter.nix index cffdca4083cf..f97fc84aa2b7 100644 --- a/pkgs/servers/monitoring/prometheus/fastly-exporter.nix +++ b/pkgs/servers/monitoring/prometheus/fastly-exporter.nix @@ -2,16 +2,16 @@ buildGoModule rec { pname = "fastly-exporter"; - version = "6.1.0"; + version = "7.0.1"; src = fetchFromGitHub { owner = "peterbourgon"; repo = pname; rev = "v${version}"; - sha256 = "0my0pcxix5rk73m5ciz513nwmjcm7vjs6r8wg3vddm0xixv7zq94"; + sha256 = "sha256-KL+UfYuHtfQ9sKad7Q1KqIK4CFzDsIWvgG1YO1ZbUQc="; }; - vendorSha256 = "1w9asky8h8l5gc0c6cv89m38qw50hyhma8qbsw3zirplhk9mb3r2"; + vendorSha256 = "sha256-yE7yvnyDfrrFdBmBBYe2gBU7b4gOWl5kfqkoblE51EQ="; meta = with lib; { description = "Prometheus exporter for the Fastly Real-time Analytics API"; From 3907d19260520a2939d8463e0fe0a65bd6f60b37 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 20 Dec 2021 10:57:31 -0500 Subject: [PATCH 3/3] services.prometheus.exporters.fastly: add a smoke test --- .../monitoring/prometheus/exporters/fastly.nix | 2 +- nixos/tests/prometheus-exporters.nix | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/monitoring/prometheus/exporters/fastly.nix b/nixos/modules/services/monitoring/prometheus/exporters/fastly.nix index 551c61ba9e44..55a61c4949ee 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/fastly.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/fastly.nix @@ -33,7 +33,7 @@ in ${optionalString (cfg.tokenPath != null) "export FASTLY_API_TOKEN=$(cat ${toString cfg.tokenPath})"} ${pkgs.prometheus-fastly-exporter}/bin/fastly-exporter \ - -endpoint http://${cfg.listenAddress}:${toString cfg.port}/metrics + -listen http://${cfg.listenAddress}:${toString cfg.port} ${optionalString cfg.debug "-debug true"} \ ${optionalString (cfg.configFile != null) "-config-file ${cfg.configFile}"} ''; diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix index 008a5edd071d..036c037e426c 100644 --- a/nixos/tests/prometheus-exporters.nix +++ b/nixos/tests/prometheus-exporters.nix @@ -259,6 +259,19 @@ let ''; }; + fastly = { + exporterConfig = { + enable = true; + tokenPath = pkgs.writeText "token" "abc123"; + }; + + # noop: fastly's exporter can't start without first talking to fastly + # see: https://github.com/peterbourgon/fastly-exporter/issues/87 + exporterTest = '' + succeed("true"); + ''; + }; + fritzbox = { # TODO add proper test case exporterConfig = {