10 cfg = config.services.prometheus.exporters.dovecot;
21 telemetryPath = mkOption {
25 Path under which to expose metrics.
28 socketPath = mkOption {
30 default = "/var/run/dovecot/stats";
31 example = "/var/run/dovecot2/old-stats";
33 Path under which the stats socket is placed.
34 The user/group under which the exporter runs,
35 should be able to access the socket in order
36 to scrape the metrics successfully.
38 Please keep in mind that the stats module has changed in
39 [Dovecot 2.3+](https://wiki2.dovecot.org/Upgrading/2.3) which
40 is not [compatible with this exporter](https://github.com/kumina/dovecot_exporter/issues/8).
42 The following extra config has to be passed to Dovecot to ensure that recent versions
43 work with this exporter:
46 services.prometheus.exporters.dovecot.enable = true;
47 services.prometheus.exporters.dovecot.socketPath = "/var/run/dovecot2/old-stats";
48 services.dovecot2.mailPlugins.globally.enable = [ "old_stats" ];
49 services.dovecot2.extraConfig = '''
51 unix_listener old-stats {
52 user = dovecot-exporter
53 group = dovecot-exporter
56 fifo_listener old-stats-mail {
61 fifo_listener old-stats-user {
68 old_stats_refresh = 30 secs
69 old_stats_track_cmds = yes
77 type = types.listOf types.str;
84 Stats scopes to query.
92 ${pkgs.prometheus-dovecot-exporter}/bin/dovecot_exporter \
93 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
94 --web.telemetry-path ${cfg.telemetryPath} \
95 --dovecot.socket-path ${escapeShellArg cfg.socketPath} \
96 --dovecot.scopes ${concatStringsSep "," cfg.scopes} \
97 ${concatStringsSep " \\\n " cfg.extraFlags}
99 RestrictAddressFamilies = [
100 # Need AF_UNIX to collect data