A Prometheus exporter for Postfix.
Go to file
2024-04-24 09:53:02 +02:00
.github/workflows Changes CI config to GitHub Actions 2023-01-29 12:56:52 +01:00
mock Adding some test for the showq part. Found a minor bug. 2020-02-24 15:42:20 +01:00
testdata Adding some test for the showq part. Found a minor bug. 2020-02-24 15:42:20 +01:00
.dockerignore Cleaning up the Dockerfile 2020-02-18 13:33:30 +01:00
.gitignore Ignoring more files 2020-02-12 13:38:03 +01:00
.travis.yml Upgrade golang to 1.16 2021-08-31 12:58:35 -06:00
build-man.sh Adds build script + adapts CI config 2022-01-22 14:58:59 +01:00
build_static.sh Upgrade golang to 1.16 2021-08-31 12:58:35 -06:00
CHANGELOG.md update changelog 2021-05-02 23:04:26 +02:00
docker-compose.yml Adapted docker-compose file to "new" log path mount point in container 2021-10-03 17:59:29 +02:00
Dockerfile Upgrade golang to 1.16 2021-08-31 12:58:35 -06:00
go.mod Upgrade golang to 1.16 2021-08-31 12:58:35 -06:00
go.sum Upgrade golang to 1.16 2021-08-31 12:58:35 -06:00
LICENSE Check in an initial copy of our Postfix metrics exporter. 2017-02-17 15:29:37 +01:00
logsource.go Adds a Docker log source. 2021-03-16 15:37:29 +01:00
logsource_docker.go Adds a Docker log source. 2021-03-16 15:37:29 +01:00
logsource_docker_test.go Adds a Docker log source. 2021-03-16 15:37:29 +01:00
logsource_file.go Merge pull request #77 from ylecuyer/fix-mail-log-default-yle 2021-08-17 10:00:04 +02:00
logsource_file_test.go Splits the log source handling with a pluggable interface. 2021-03-16 15:36:56 +01:00
logsource_systemd.go Adds a Docker log source. 2021-03-16 15:37:29 +01:00
logsource_systemd_test.go Splits the log source handling with a pluggable interface. 2021-03-16 15:36:56 +01:00
main.go Adds a Docker log source. 2021-03-16 15:37:29 +01:00
postfix_exporter.go Expose the severity of unsupported lines 2021-04-14 12:41:37 +02:00
postfix_exporter_test.go Expose the severity of unsupported lines 2021-04-14 12:41:37 +02:00
README.md Fix: Default for mail log path 2021-05-02 23:01:50 +02:00
showq_test.go Adding some test for the showq part. Found a minor bug. 2020-02-24 15:42:20 +01:00

Prometheus Postfix exporter

Prometheus metrics exporter for the Postfix mail server. This exporter provides histogram metrics for the size and age of messages stored in the mail queue. It extracts these metrics from Postfix by connecting to a UNIX socket under /var/spool. It also counts events by parsing Postfix's log entries, using regular expression matching. The log entries are retrieved from the systemd journal, the Docker logs, or from a log file.

Options

These options can be used when starting the postfix_exporter

Flag Description Default
--web.listen-address Address to listen on for web interface and telemetry 9154
--web.telemetry-path Path under which to expose metrics /metrics
--postfix.showq_path Path at which Postfix places its showq socket /var/spool/postfix/public/showq
--postfix.logfile_path Path where Postfix writes log entries /var/log/mail.log
--log.unsupported Log all unsupported lines false
--docker.enable Read from the Docker logs instead of a file false
--docker.container.id The container to read Docker logs from postfix
--systemd.enable Read from the systemd journal instead of file false
--systemd.unit Name of the Postfix systemd unit postfix.service
--systemd.slice Name of the Postfix systemd slice. ""
--systemd.journal_path Path to the systemd journal ""

Events from Docker

Postfix servers running in a Docker container can be monitored using the --docker.enable flag. The default container ID is postfix, but can be customized with the --docker.container.id flag.

The default is to connect to the local Docker, but this can be customized using the DOCKER_HOST and similar environment variables.

Events from log file

The log file is tailed when processed. Rotating the log files while the exporter is running is OK. The path to the log file is specified with the --postfix.logfile_path flag.

Events from systemd

Retrieval from the systemd journal is enabled with the --systemd.enable flag. This overrides the log file setting. It is possible to specify the unit (with --systemd.unit) or slice (with --systemd.slice). Additionally, it is possible to read the journal from a directory with the --systemd.journal_path flag.

Build options

Default the exporter is build with systemd journal functionality (but it is disabled at default). Because the systemd headers are required for building with systemd, there is an option to build the exporter without systemd. Use the build tag nosystemd.

go build -tags nosystemd