@cryptotaxi247 / infra-1 / commits / 10fb009b

delft/eris: use fastly exporter from nixpkgs

Martin Weinelt committed Dec 17, 2021 at 22:38 UTC 10fb009b273464767e5dea96d6545cd9cd2e15a5
2 files changed +8 -39
delft/eris.nix
+8 -16
@@ -568,22 +568,14 @@ in {
568 keyFile = /home/deploy/src/nixos-org-configurations/fastly-read-only-api-token;
569 };
570
571 - systemd.services.prometheus-fastly-exporter = let
572 - fastly = pkgs.callPackage ./prometheus/fastly.nix {};
573 - in {
574 - wantedBy = [ "multi-user.target" "prometheus.service" ];
575 - after = [ "network.target" ];
576 -
577 - script = ''
578 - export FASTLY_API_TOKEN=$(cat /run/keys/fastly-read-only-api-token)
579 - ${fastly}/bin/fastly-exporter \
580 - -endpoint http://127.0.0.1:9118/metrics
581 - '';
571 + services.prometheus.exporters.fastly = {
572 + enable = true;
573 + listenAddress = "127.0.0.1";
574 + tokenPath = "/run/keys/fastly-read-only-api-token";
575 + };
576
583 - serviceConfig = {
584 - Group = "keys";
585 - Restart = "always";
586 - RestartSec = "60s";
587 - };
577 + systemd.services.prometheus-fastly-exporter.serviceConfig = {
578 + SupplementaryGroups = [ "keys" ];
579 + RestartSec = "60s";
580 };
581 }
delft/prometheus/fastly.nix deleted
-23
@@ -1,23 +0,0 @@
1 -{ lib, buildGoModule, fetchFromGitHub }:
2 -# Introduced in PR #133726 and should be removed when the network updates
3 -# to 21.11 or later.
4 -buildGoModule rec {
5 - pname = "fastly-exporter";
6 - version = "6.1.0";
7 -
8 - src = fetchFromGitHub {
9 - owner = "peterbourgon";
10 - repo = pname;
11 - rev = "v${version}";
12 - sha256 = "0my0pcxix5rk73m5ciz513nwmjcm7vjs6r8wg3vddm0xixv7zq94";
13 - };
14 -
15 - vendorSha256 = "1w9asky8h8l5gc0c6cv89m38qw50hyhma8qbsw3zirplhk9mb3r2";
16 -
17 - meta = with lib; {
18 - description = "Prometheus exporter for the Fastly Real-time Analytics API";
19 - homepage = "https://github.com/peterbourgon/fastly-exporter";
20 - license = licenses.asl20;
21 - maintainers = teams.deshaw.members;
22 - };
23 -}