diff options
author | WilliButz <WilliButz@users.noreply.github.com> | 2021-02-08 11:54:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 11:54:13 +0100 |
commit | bfa15ad9564f22e60b43a7b5f578ae3e5bd0ad7d (patch) | |
tree | 79eaddb9732442491282b43be6cdaf774f760009 | |
parent | 93498b15264bb796d4ff3a08971b96847cdd9391 (diff) | |
parent | c6ec272c78d49dfe7b232b3c63b25c98d069e462 (diff) |
Merge pull request #112351 from logan12358/prometheus-nginx-exporter-service
nixos/prometheus-nginx-exporter: only create service if nginx exporter is enabled
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters.nix | 3 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters/nginx.nix | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index 1fd85c66f843d..64de15f4a2faf 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -238,9 +238,6 @@ in services.prometheus.exporters.minio.minioAccessSecret = mkDefault config.services.minio.secretKey; })] ++ [(mkIf config.services.prometheus.exporters.rtl_433.enable { hardware.rtl-sdr.enable = mkDefault true; - })] ++ [(mkIf config.services.nginx.enable { - systemd.services.prometheus-nginx-exporter.after = [ "nginx.service" ]; - systemd.services.prometheus-nginx-exporter.requires = [ "nginx.service" ]; })] ++ [(mkIf config.services.postfix.enable { services.prometheus.exporters.postfix.group = mkDefault config.services.postfix.setgidGroup; })] ++ (mapAttrsToList (name: conf: diff --git a/nixos/modules/services/monitoring/prometheus/exporters/nginx.nix b/nixos/modules/services/monitoring/prometheus/exporters/nginx.nix index 56cddfc55b719..5ee8c346be1dc 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/nginx.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/nginx.nix @@ -42,7 +42,7 @@ in ''; }; }; - serviceOpts = { + serviceOpts = mkMerge ([{ serviceConfig = { ExecStart = '' ${pkgs.prometheus-nginx-exporter}/bin/nginx-prometheus-exporter \ @@ -54,7 +54,10 @@ in ${concatStringsSep " \\\n " cfg.extraFlags} ''; }; - }; + }] ++ [(mkIf config.services.nginx.enable { + after = [ "nginx.service" ]; + requires = [ "nginx.service" ]; + })]); imports = [ (mkRenamedOptionModule [ "telemetryEndpoint" ] [ "telemetryPath" ]) (mkRemovedOptionModule [ "insecure" ] '' |