Dovecot
Dovecot is a secure, open-source IMAP and POP3 email server for Unix-like operating systems.
Auto-Detection
Section titled “Auto-Detection”Bleemeo monitors the Dovecot mail server through automatic service detection by process, a
service check on port 143, and built-in metrics read from the old_stats plugin on
a separate port that defaults to 24242. If the auto-detected parameters are
incorrect, you can override them manually — stats_port is the old_stats listener’s port,
and metrics_unix_socket reads the same statistics from a unix socket instead.
sudo tee /etc/glouton/conf.d/99-dovecot.conf > /dev/null << 'EOF'service: # For a Dovecot running outside a container - type: "dovecot" address: "127.0.0.1" port: 143 # IMAP listener; IMAPS is not supported here stats_port: 24242
# For a Dovecot whose old_stats listener is a unix socket - type: "dovecot" address: "127.0.0.1" port: 143 metrics_unix_socket: "/run/dovecot/old-stats"
# For a Dovecot running in a Docker container - type: "dovecot" instance: "CONTAINER_NAME" port: 143 stats_port: 24242EOFDovecot does not run on Windows.
Glouton automatically detects configuration changes.
Requirements
Section titled “Requirements”Dovecot 2.3 or prior is required. The old_stats plugin was removed in Dovecot 2.4, and the
configuration below makes a 2.4 server refuse to start.
The old_stats plugin must be enabled, with a listener Glouton can reach — an
inet_listener, or the unix_listener below. Without one the service is detected and
checked, but reports no metrics. In /etc/dovecot/conf.d/90-stats.conf:
mail_plugins = $mail_plugins old_stats
service old-stats { unix_listener old-stats { user = $default_internal_user mode = 0600 } inet_listener { address = 0.0.0.0 port = 24242 } fifo_listener old-stats-mail { mode = 0666 } fifo_listener old-stats-user { mode = 0666 }}
plugin { old_stats_refresh = 10 secs old_stats_track_cmds = yes}
protocol imap { mail_plugins = $mail_plugins imap_old_stats}Restart Dovecot after the change.
The protocol imap block is what makes old_stats_track_cmds actually count commands.
Without imap_old_stats, everything else still works but dovecot_num_cmds stays at zero.
Reading old_stats Over a Unix Socket
Section titled “Reading old_stats Over a Unix Socket”metrics_unix_socket points Glouton at the unix_listener instead of the inet_listener,
so the statistics never have to be exposed on a TCP port. It takes precedence over
stats_port, and Glouton falls back to the TCP listener when the path does not exist.
The socket is named after the listener, so the configuration above puts it at
/run/dovecot/old-stats (/var/run/dovecot/old-stats on older distributions). Its
mode = 0600 only lets $default_internal_user connect, and Glouton runs as the glouton
user, so the listener has to let that user in:
unix_listener old-stats { user = $default_internal_user group = glouton mode = 0660 }This is for a Dovecot installed on the machine: the path is resolved on Glouton’s own
filesystem, so a Dovecot in a container is read through its inet_listener unless the
socket is bind-mounted into the agent.
Service Check
Section titled “Service Check”Glouton opens the IMAP port and reads the server’s greeting.
| Metric | Description |
|---|---|
service_status | Status of Dovecot |
Built-in Metrics
Section titled “Built-in Metrics”Server-wide totals, not per user or per mailbox.
| Metric | Description |
|---|---|
dovecot_num_connected_sessions | Number of Dovecot connected sessions |
dovecot_num_logins | Number of Dovecot logins, per second |
dovecot_num_cmds | Number of Dovecot IMAP/POP3 commands processed, per second |
dovecot_auth_successes | Number of successful Dovecot authentications, per second |
dovecot_auth_failures | Number of Dovecot authentication failures, per second |
Monitoring Troubleshooting
Section titled “Monitoring Troubleshooting”See Troubleshoot a Service Check or Missing Metrics for what applies to every service: finding the address and port Glouton really uses, what each check message means, and how to read the collection error — which does not appear in the agent logs at the default level.
The Service Check is not OK
Section titled “The Service Check is not OK”The check opens the IMAP port and expects a greeting, so beyond the usual Connection refused and connection timed out after 10 seconds it also fails when something that is
not an IMAP server answers there. Pointing it at the IMAPS port (993) fails for that
reason: the check speaks plain IMAP and does not negotiate TLS.
Metrics are Missing
Section titled “Metrics are Missing”Reproduce what Glouton does, from the machine where the agent runs:
printf 'EXPORT\tglobal\n' | nc 127.0.0.1 24242 # inet_listenerprintf 'EXPORT\tglobal\n' | nc -U /run/dovecot/old-stats # unix_listener| What you see | Cause | Fix |
|---|---|---|
| a connection error | The old_stats inet_listener is not configured |
Add it and restart Dovecot |
| a connection error | The listener is on another port | Set stats_port to match |
Permission denied on the socket |
The unix_listener does not let the glouton user connect |
Give it group = glouton and mode = 0660 |
| metrics still read from the TCP listener | The metrics_unix_socket path does not exist, so Glouton fell back |
Fix the path — it is the listener’s name under Dovecot’s base_dir |
| counters that all read zero | The FIFOs are missing or unreadable by the mail processes | Declare old-stats-mail and old-stats-user as fifo_listener with mode 0666 |
dovecot_num_cmds alone at zero |
imap_old_stats is not in the imap protocol’s mail_plugins |
Add the protocol imap block from Requirements |
| Dovecot refuses to start | The server is 2.4 or newer | old_stats no longer exists; metrics need 2.3 |