nixos/prometheus-postfix-exporter: update module

Changed files
+36 -1
nixos
modules
services
monitoring
prometheus
exporters
+36 -1
nixos/modules/services/monitoring/prometheus/exporters/postfix.nix
···
Path where Postfix places it's showq socket.
'';
};
+
systemd = {
+
enable = mkEnableOption ''
+
reading metrics from the systemd-journal instead of from a logfile
+
'';
+
unit = mkOption {
+
type = types.str;
+
default = "postfix.service";
+
description = ''
+
Name of the postfix systemd unit.
+
'';
+
};
+
slice = mkOption {
+
type = types.nullOr types.str;
+
default = null;
+
description = ''
+
Name of the postfix systemd slice.
+
This overrides the <option>systemd.unit</option>.
+
'';
+
};
+
journalPath = mkOption {
+
type = types.nullOr types.path;
+
default = null;
+
description = ''
+
Path to the systemd journal.
+
'';
+
};
+
};
};
serviceOpts = {
serviceConfig = {
···
${pkgs.prometheus-postfix-exporter}/bin/postfix_exporter \
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
--web.telemetry-path ${cfg.telemetryPath} \
-
${concatStringsSep " \\\n " cfg.extraFlags}
+
--postfix.showq_path ${cfg.showqPath} \
+
${concatStringsSep " \\\n " (cfg.extraFlags
+
++ optional cfg.systemd.enable "--systemd.enable"
+
++ optional cfg.systemd.enable (if cfg.systemd.slice != null
+
then "--systemd.slice ${cfg.systemd.slice}"
+
else "--systemd.unit ${cfg.systemd.unit}")
+
++ optional (cfg.systemd.enable && (cfg.systemd.journalPath != null))
+
"--systemd.jounal_path ${cfg.systemd.journalPath}"
+
++ optional (!cfg.systemd.enable) "--postfix.logfile_path ${cfg.logfilePath}")}
'';
};
};