about summary refs log tree commit diff
path: root/nixos/modules/services/monitoring/prometheus/exporters
diff options
context:
space:
mode:
authorWilliButz <wbutz@cyberfnord.de>2018-03-28 17:22:06 +0200
committerWilliButz <wbutz@cyberfnord.de>2018-04-19 19:47:13 +0200
commitc3d46165dbfcce221ce2ca2a835051e20e56041e (patch)
tree8404b3f0e6ca31a53dbc21a216ff1ac832e76130 /nixos/modules/services/monitoring/prometheus/exporters
parentf45acb6b472ed772a70d5fbd113d4ae907a481a0 (diff)
downloadnixlib-c3d46165dbfcce221ce2ca2a835051e20e56041e.tar
nixlib-c3d46165dbfcce221ce2ca2a835051e20e56041e.tar.gz
nixlib-c3d46165dbfcce221ce2ca2a835051e20e56041e.tar.bz2
nixlib-c3d46165dbfcce221ce2ca2a835051e20e56041e.tar.lz
nixlib-c3d46165dbfcce221ce2ca2a835051e20e56041e.tar.xz
nixlib-c3d46165dbfcce221ce2ca2a835051e20e56041e.tar.zst
nixlib-c3d46165dbfcce221ce2ca2a835051e20e56041e.zip
nixos/prometheus-postfix-exporter: update module
Diffstat (limited to 'nixos/modules/services/monitoring/prometheus/exporters')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/postfix.nix37
1 files changed, 36 insertions, 1 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/postfix.nix b/nixos/modules/services/monitoring/prometheus/exporters/postfix.nix
index 1e909aa27d83..efe78ebcba86 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/postfix.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/postfix.nix
@@ -32,6 +32,33 @@ in
         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 = {
@@ -39,7 +66,15 @@ in
         ${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}")}
       '';
     };
   };