2017-02-17 15:04:32 +00:00
|
|
|
# Prometheus Postfix exporter
|
|
|
|
|
2020-05-15 12:23:59 +00:00
|
|
|
Prometheus metrics exporter for [the Postfix mail server](http://www.postfix.org/).
|
|
|
|
This exporter provides histogram metrics for the size and age of messages stored in
|
2017-05-02 13:07:19 +00:00
|
|
|
the mail queue. It extracts these metrics from Postfix by connecting to
|
2020-05-15 12:23:59 +00:00
|
|
|
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
|
2020-06-21 06:24:36 +00:00
|
|
|
the systemd journal, the Docker logs, or from a log file.
|
2020-05-15 12:23:59 +00:00
|
|
|
|
|
|
|
## 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` |
|
2021-05-02 21:01:50 +00:00
|
|
|
| `--postfix.logfile_path` | Path where Postfix writes log entries | `/var/log/mail.log` |
|
2020-05-15 12:23:59 +00:00
|
|
|
| `--log.unsupported` | Log all unsupported lines | `false` |
|
2020-06-21 06:24:36 +00:00
|
|
|
| `--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` |
|
2020-05-15 12:23:59 +00:00
|
|
|
| `--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 | `""` |
|
2018-02-13 10:15:04 +00:00
|
|
|
|
2020-06-21 06:24:36 +00:00
|
|
|
## Events from Docker
|
|
|
|
|
|
|
|
Postfix servers running in a [Docker](https://www.docker.com/)
|
|
|
|
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](https://pkg.go.dev/github.com/docker/docker/client?tab=doc#NewEnvClient)
|
|
|
|
environment variables.
|
|
|
|
|
2018-02-13 10:15:04 +00:00
|
|
|
## Events from log file
|
|
|
|
|
2018-09-30 22:16:10 +00:00
|
|
|
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
|
2019-02-15 11:41:28 +00:00
|
|
|
`--postfix.logfile_path` flag.
|
2018-02-02 10:51:33 +00:00
|
|
|
|
2018-02-13 10:15:04 +00:00
|
|
|
## Events from systemd
|
2018-02-02 10:51:33 +00:00
|
|
|
|
2019-02-15 11:41:28 +00:00
|
|
|
Retrieval from the systemd journal is enabled with the `--systemd.enable` flag.
|
2018-02-13 10:15:04 +00:00
|
|
|
This overrides the log file setting.
|
2019-02-15 11:41:28 +00:00
|
|
|
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.
|
2018-05-04 10:22:34 +00:00
|
|
|
|
|
|
|
## 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
|
|
|
|
```
|