Skip to content
Snippets Groups Projects
Commit 752e7bc3 authored by godog's avatar godog
Browse files

Use dedicated stats listener for old_stats

By default Dovecot old_stats will create the socket owned by root (non
overridable from the configuration). Thus switch to a dedicated socket
and provide an example configuration.
parent 81b443db
No related branches found
No related tags found
No related merge requests found
...@@ -4,9 +4,21 @@ This repository provides a `dovecot_exporter` utility that can be used ...@@ -4,9 +4,21 @@ This repository provides a `dovecot_exporter` utility that can be used
to scrape statistics from Dovecot and export them as Prometheus metrics. to scrape statistics from Dovecot and export them as Prometheus metrics.
It extracts the metrics that are exposed by It extracts the metrics that are exposed by
[Dovecot's stats module](https://wiki2.dovecot.org/Statistics/Old) by [Dovecot's stats module](https://wiki2.dovecot.org/Statistics/Old) by
connecting to UNIX socket `/var/run/dovecot/stats` and serves them as connecting to UNIX socket `/var/run/dovecot/stats-exporter` and serves them as
Prometheus metrics over TCP port 9166. Prometheus metrics over TCP port 9166.
The socket will be created with the appropriate permissions by this Dovecot
configuration:
```
service stats {
fifo_listener stats-exporter {
user = dovecot
mode = 0600
}
}
```
A list of command line flags supported by this utility can be obtained A list of command line flags supported by this utility can be obtained
by looking at this exporter's `main()` function. Do note that all by looking at this exporter's `main()` function. Do note that all
command line flags require two leading dashes (e.g., command line flags require two leading dashes (e.g.,
......
ADDR=:9166 ADDR=:9166
SCOPES=global SCOPES=global
DOVECOT_SOCKET=/var/run/dovecot/old-stats DOVECOT_SOCKET=/var/run/dovecot/stats-exporter
...@@ -208,7 +208,7 @@ func main() { ...@@ -208,7 +208,7 @@ func main() {
app = kingpin.New("dovecot_exporter", "Prometheus metrics exporter for Dovecot") app = kingpin.New("dovecot_exporter", "Prometheus metrics exporter for Dovecot")
listenAddress = app.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9166").String() listenAddress = app.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9166").String()
metricsPath = app.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").String() metricsPath = app.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").String()
socketPath = app.Flag("dovecot.socket-path", "Path under which to expose metrics.").Default("/var/run/dovecot/stats").String() socketPath = app.Flag("dovecot.socket-path", "Path under which to expose metrics.").Default("/var/run/dovecot/stats-exporter").String()
dovecotScopes = app.Flag("dovecot.scopes", "Stats scopes to query (comma separated)").Default("user").String() dovecotScopes = app.Flag("dovecot.scopes", "Stats scopes to query (comma separated)").Default("user").String()
) )
kingpin.MustParse(app.Parse(os.Args[1:])) kingpin.MustParse(app.Parse(os.Args[1:]))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment