10 cfg = config.services.prometheus.exporters.nginx;
24 scrapeUri = mkOption {
26 default = "http://localhost/nginx_status";
28 Address to access the nginx status page.
29 Can be enabled with services.nginx.statusPage = true.
32 telemetryPath = mkOption {
36 Path under which to expose metrics.
39 sslVerify = mkOption {
43 Whether to perform certificate verification for https.
46 constLabels = mkOption {
47 type = types.listOf types.str;
54 A list of constant labels that will be used in every metric.
58 serviceOpts = mkMerge (
61 environment.CONST_LABELS = concatStringsSep "," cfg.constLabels;
64 ${pkgs.prometheus-nginx-exporter}/bin/nginx-prometheus-exporter \
65 --nginx.scrape-uri='${cfg.scrapeUri}' \
66 --${lib.optionalString (!cfg.sslVerify) "no-"}nginx.ssl-verify \
67 --web.listen-address=${cfg.listenAddress}:${toString cfg.port} \
68 --web.telemetry-path=${cfg.telemetryPath} \
69 ${concatStringsSep " \\\n " cfg.extraFlags}
75 (mkIf config.services.nginx.enable {
76 after = [ "nginx.service" ];
77 requires = [ "nginx.service" ];
82 (mkRenamedOptionModule [ "telemetryEndpoint" ] [ "telemetryPath" ])
83 (mkRemovedOptionModule [ "insecure" ] ''
84 This option was replaced by 'prometheus.exporters.nginx.sslVerify'.
87 options.warnings = options.warnings;
88 options.assertions = options.assertions;