
As the configuration for the exporters and alertmanager is unchanged between the two major versions this patch tries to minimize duplication while at the same time as there's no upgrade path from 1.x to 2.x, it allows running the two services in parallel. See also #56037
49 lines
1.2 KiB
Nix
49 lines
1.2 KiB
Nix
{ config, lib, pkgs }:
|
|
|
|
with lib;
|
|
|
|
baseCfg:
|
|
let
|
|
cfg = baseCfg.nginx;
|
|
in
|
|
{
|
|
port = 9113;
|
|
extraOpts = {
|
|
scrapeUri = mkOption {
|
|
type = types.str;
|
|
default = "http://localhost/nginx_status";
|
|
description = ''
|
|
Address to access the nginx status page.
|
|
Can be enabled with services.nginx.statusPage = true.
|
|
'';
|
|
};
|
|
telemetryEndpoint = mkOption {
|
|
type = types.str;
|
|
default = "/metrics";
|
|
description = ''
|
|
Path under which to expose metrics.
|
|
'';
|
|
};
|
|
insecure = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = ''
|
|
Ignore server certificate if using https.
|
|
'';
|
|
};
|
|
};
|
|
serviceOpts = {
|
|
serviceConfig = {
|
|
DynamicUser = true;
|
|
ExecStart = ''
|
|
${pkgs.prometheus-nginx-exporter}/bin/nginx_exporter \
|
|
--nginx.scrape_uri '${cfg.scrapeUri}' \
|
|
--telemetry.address ${cfg.listenAddress}:${toString cfg.port} \
|
|
--telemetry.endpoint ${cfg.telemetryEndpoint} \
|
|
--insecure ${toString cfg.insecure} \
|
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
|
'';
|
|
};
|
|
};
|
|
}
|