nixos/prometheus-nginx-exporter: only create service if nginx exporter is enabled
On a system with nginx enabled but the prometheus exporter not enabled, the prometheus-nginx-exporter service should not be created.
This commit is contained in:
parent
98dd794037
commit
c6ec272c78
@ -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:
|
||||
|
@ -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" ] ''
|
||||
|
Loading…
Reference in New Issue
Block a user