Add prometheus exporter for postfix and option postfix.metrics_address

This commit is contained in:
Julian Rother 2022-04-02 03:55:07 +02:00
parent 83df531b00
commit 3162809647
No known key found for this signature in database
GPG key ID: 2F811E2338EE029B
4 changed files with 34 additions and 0 deletions

View file

@ -44,3 +44,4 @@ postfix:
add_header_checks: []
smtpd_milters: []
non_smtpd_milters: []
metrics_address: "127.0.0.1:9154"

View file

@ -3,3 +3,6 @@
- name: restart saslauthd
service: name=saslauthd state=restarted
- name: restart prometheus-postfix-exporter
service: name=prometheus-postfix-exporter state=restarted

View file

@ -3,6 +3,21 @@
pkg:
- postfix
- name: install prometheus postfix exporter
apt:
pkg:
- prometheus-postfix-exporter
- name: configure prometheus postfix exporter
template:
src: prometheus-postfix-exporter.j2
dest: /etc/default/prometheus-postfix-exporter
owner: root
group: root
mode: 0644
notify:
- restart prometheus-postfix-exporter
- name: Install and setup utilities for LDAP
when: postfix.ldap.enable
block:

View file

@ -0,0 +1,15 @@
# Private log file from Postfix to read and truncate. Configured in
# /etc/rsyslog.d/prometheus-postfix-exporter.conf
POSTFIXLOGFILE=/var/lib/prometheus/postfix-exporter/mail.log
# Extra arguments for the daemon.
ARGS='--web.listen-address {{ postfix.metrics_address }}'
# Prometheus-postfix-exporter supports the following options:
# --postfix.showq_path string
# Path at which Postfix places its showq socket.
# (default "/var/spool/postfix/public/showq")
# --web.listen-address string
# Address to listen on for web interface and telemetry. (default ":9154")
# --web.telemetry-path string
# Path under which to expose metrics. (default "/metrics")