I'd like to monitor my dovecot instance (running on ubuntu 16.04) using telegraf. [T] jeff at nantes-1:log $ dovecot --version 2.2.22 (fe789d2) [T] jeff at nantes-1:log $ To do that, I think I need to use the stats module and get it to talk on port 24242.? I've not found enough documentation on this module to feel really comfortable with it, so it doesn't surprise me that I don't have it working.? But I'd much appreciate if someone could point me in the right direction. In particular, nothing listens on 24242. ??? # This file is based on https://wiki2.dovecot.org/Statistics ??? # Dovecot v2.1+ supports gathering statistics (CPU, disk usage, etc.) ??? # from mail processes (IMAP, POP3, LMTP, etc.) to the stats ??? # process. The stats process can later be queried what's going on in ??? # the system. With imap_stats plugin you can get per-command level ??? # statistics for IMAP commands. ??? # ??? # There are different "zoom levels" you can look at the statistics: ??? # ??? # * command: Per-IMAP command ??? # * session: Per IMAP/POP3 connection ??? # * user: Per user (all of user's sessions summed up) ??? # * domain: Per domain (all of domain's users summed up) ??? # * ip: Per IP address (all sessions from the IP summed up) ??? # * global: Everything summed up (2.2.16+) ??? mail_plugins = $mail_plugins stats ??? protocol imap { ????? mail_plugins = $mail_plugins imap_stats ??? } ??? plugin { ????? # how often to session statistics (must be set) ????? stats_refresh = 30 secs ????? # track per-IMAP command statistics (optional) ????? stats_track_cmds = yes ??? } ??? # You'll also need to give enough permissions for mail processes to be ??? # able to write to stats-mail fifo. For example if you use a single ??? # "vmail" user for mail access: ??? service stats { ????? fifo_listener stats-mail { ??????? user = vmail ??????? mode = 0600 ????? } ??? } ??? # Memory usage configuration ??? # The stats process attempts to keep memory usage below a specified ??? # amount. This value is only approximate because of extra overhead ??? # caused by malloc() itself. ??? stats_memory_limit = 16 M ??? # Once the memory limit is reached, oldest statistics are freed from ??? # memory. Different statistics levels have different timeout limits, ??? # which are configured in: ??? stats_command_min_time = 1 mins ??? stats_domain_min_time = 12 hours ??? stats_ip_min_time = 12 hours ??? stats_session_min_time = 15 mins ??? stats_user_min_time = 1 hours ??? service stats { ????? inet_listener { ??????? address = 127.0.0.1 ??????? port = 24242 ????? } ??? } Thanks in advance. -- Jeff Abrahamson +33 6 24 40 01 57 +44 7920 594 255 http://p27.eu/jeff/
Hi! To add inet listener for stats, do service stats { ?? inet_listener { ????? port = 24242 ? } } Aki On 02.11.2017 23:22, Jeff Abrahamson wrote:> I'd like to monitor my dovecot instance (running on ubuntu 16.04) using > telegraf. > > [T] jeff at nantes-1:log $ dovecot --version > 2.2.22 (fe789d2) > [T] jeff at nantes-1:log $ > > To do that, I think I need to use the stats module and get it to talk on > port 24242.? I've not found enough documentation on this module to feel > really comfortable with it, so it doesn't surprise me that I don't have > it working.? But I'd much appreciate if someone could point me in the > right direction. > > In particular, nothing listens on 24242. > > ??? # This file is based on https://wiki2.dovecot.org/Statistics > > ??? # Dovecot v2.1+ supports gathering statistics (CPU, disk usage, etc.) > ??? # from mail processes (IMAP, POP3, LMTP, etc.) to the stats > ??? # process. The stats process can later be queried what's going on in > ??? # the system. With imap_stats plugin you can get per-command level > ??? # statistics for IMAP commands. > ??? # > ??? # There are different "zoom levels" you can look at the statistics: > ??? # > ??? # * command: Per-IMAP command > ??? # * session: Per IMAP/POP3 connection > ??? # * user: Per user (all of user's sessions summed up) > ??? # * domain: Per domain (all of domain's users summed up) > ??? # * ip: Per IP address (all sessions from the IP summed up) > ??? # * global: Everything summed up (2.2.16+) > > ??? mail_plugins = $mail_plugins stats > ??? protocol imap { > ????? mail_plugins = $mail_plugins imap_stats > ??? } > ??? plugin { > ????? # how often to session statistics (must be set) > ????? stats_refresh = 30 secs > ????? # track per-IMAP command statistics (optional) > ????? stats_track_cmds = yes > ??? } > > ??? # You'll also need to give enough permissions for mail processes to be > ??? # able to write to stats-mail fifo. For example if you use a single > ??? # "vmail" user for mail access: > ??? service stats { > ????? fifo_listener stats-mail { > ??????? user = vmail > ??????? mode = 0600 > ????? } > ??? } > > ??? # Memory usage configuration > > ??? # The stats process attempts to keep memory usage below a specified > ??? # amount. This value is only approximate because of extra overhead > ??? # caused by malloc() itself. > > ??? stats_memory_limit = 16 M > > ??? # Once the memory limit is reached, oldest statistics are freed from > ??? # memory. Different statistics levels have different timeout limits, > ??? # which are configured in: > > ??? stats_command_min_time = 1 mins > ??? stats_domain_min_time = 12 hours > ??? stats_ip_min_time = 12 hours > ??? stats_session_min_time = 15 mins > ??? stats_user_min_time = 1 hours > > ??? service stats { > ????? inet_listener { > ??????? address = 127.0.0.1 > ??????? port = 24242 > ????? } > ??? } > > Thanks in advance. >
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, 2 Nov 2017, Jeff Abrahamson wrote:> In particular, nothing listens on 24242. > > ??? service stats { > ????? inet_listener { > ??????? address = 127.0.0.1 > ??????? port = 24242 > ????? } > ??? }my conf looks almost identitical. This should do the trick, IMHO. check "doveconf -n" to see, if you have a typo somewhere or any errors show up. Second check out the error log (there might be (re)bind failures). Third, make sure you have restarted Dovecot. - -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEVAwUBWfwVaXz1H7kL/d9rAQJDHgf5AY9MxGxWjEKja9w+DdiSmzSwpNuJ57Fa kbkU8TAWQrrfJ6/uZlA7YZtFqA51HFqIO4vX+kEC2qHXJBq59x00T9CktAWAm0Cj +48fsSiAUi8A28VW+I6GTBpDaoW1d/9aZnIg3Md+QXkD7ydWwKG3V34zXxdUE4Aw mD8iPLCU8zjw9r0Yrwo51OA8yx+J0wRd06br50gDco09oNoQDBJueJyfhC4Dmlcr ELulm5g2D4WOSZpSVF+wAMjgaXeC/Tf97obuGqd7aq5/F6M3Bqo60ZaBPlizUpeY F9NSBGFCkhfSGq/mwXTWaDSveC1fG6RCW4mo85JUkhzb24kSEjEbDg==/yUC -----END PGP SIGNATURE-----
Thanks for your suggestions, Steffen. Running doveconf -n shows no errors and also, sadly, no mention of the stats listener: ?? (master=)?? ? [T] jeff at nantes-1:p27 $ doveconf -n # 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf # Pigeonhole version 0.4.13 (7b14904) # OS: Linux 4.4.0-97-generic x86_64 Ubuntu 16.04.3 LTS auth_mechanisms = plain login auth_socket_path = /var/run/dovecot/auth-userdb mail_location = maildir:~/Maildir managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext namespace inbox { ? inbox = yes ? location ? mailbox Drafts { ??? special_use = \Drafts ? } ? mailbox Junk { ??? special_use = \Junk ? } ? mailbox Sent { ??? special_use = \Sent ? } ? mailbox "Sent Messages" { ??? special_use = \Sent ? } ? mailbox Trash { ??? special_use = \Trash ? } ? prefix } passdb { ? driver = pam } plugin { ? sieve = ~/.dovecot.sieve ? sieve_dir = ~/sieve } protocols = imap sieve service auth { ? unix_listener /var/spool/postfix/private/auth { ??? group = postfix ??? mode = 0666 ??? user = postfix ? } ? unix_listener /var/spool/postfix/private/dovecot-auth { ??? group = postfix ??? mode = 0660 ??? user = postfix ? } } service imap-login { ? inet_listener imaps { ??? port = 993 ??? ssl = yes ? } } ssl_cert = </etc/dovecot/dovecot.pem ssl_cipher_list EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA ssl_key = </etc/dovecot/private/dovecot.pem ssl_protocols = !SSLv2 !SSLv3 userdb { ? driver = passwd } protocol lda { ? deliver_log_format = msgid=%m: %$ ? mail_plugins = sieve ? postmaster_address = postmaster ? quota_full_tempfail = yes ? rejection_reason = Your message to <%t> was automatically rejected:%n%r } protocol imap { ? imap_client_workarounds = delay-newmail ? mail_max_userip_connections = 20 } protocol pop3 { ? mail_max_userip_connections = 10 ? pop3_client_workarounds = outlook-no-nuls oe-ns-eoh } ?? (master=)?? ? [T] jeff at nantes-1:p27 $ Here I have a tail -f /var/log/mail.log and mail.err running in the background so we can see the results of the restart: [T] jeff at nantes-1:conf.d $ ls -l total 136 -rw-r--r-- 1 root root? 5301 Aug 25 15:26 10-auth.conf -rw-r--r-- 1 root root? 1893 Mar 16? 2016 10-director.conf -rw-r--r-- 1 root root? 2805 Mar 16? 2016 10-logging.conf -rw-r--r-- 1 root root 16172 Aug 25 15:35 10-mail.conf -rw-r--r-- 1 root root? 3547 Aug 25 15:40 10-master.conf -rw-r--r-- 1 root root? 2307 Aug 25 16:27 10-ssl.conf -rw-r--r-- 1 root root?? 291 Apr 11? 2017 10-tcpwrapper.conf -rw-r--r-- 1 root root? 1668 Mar 16? 2016 15-lda.conf -rw-r--r-- 1 root root? 2808 Mar 16? 2016 15-mailboxes.conf -rw-r--r-- 1 root root? 3295 Mar 16? 2016 20-imap.conf -rw-r--r-- 1 root root? 2398 Apr 11? 2017 20-managesieve.conf -rw-r--r-- 1 root root? 4109 Aug 25 15:28 20-pop3.conf -rw-r--r-- 1 root root?? 676 Mar 16? 2016 90-acl.conf -rw-r--r-- 1 root root?? 292 Mar 16? 2016 90-plugin.conf -rw-r--r-- 1 root root? 2502 Mar 16? 2016 90-quota.conf -rw-r--r-- 1 root root? 6822 Apr 11? 2017 90-sieve.conf -rw-r--r-- 1 root root? 1829 Apr 11? 2017 90-sieve-extprograms.conf -rw-r--r-- 1 root root? 1856 Nov? 3 16:11 91-stats -rw-r--r-- 1 root root? 1430 Oct 31 16:33 99-mail-stack-delivery.conf -rw-r--r-- 1 root root?? 499 Mar 16? 2016 auth-checkpassword.conf.ext -rw-r--r-- 1 root root?? 489 Mar 16? 2016 auth-deny.conf.ext -rw-r--r-- 1 root root?? 343 Mar 16? 2016 auth-dict.conf.ext -rw-r--r-- 1 root root?? 561 Mar 16? 2016 auth-master.conf.ext -rw-r--r-- 1 root root?? 515 Mar 16? 2016 auth-passwdfile.conf.ext -rw-r--r-- 1 root root?? 788 Mar 16? 2016 auth-sql.conf.ext -rw-r--r-- 1 root root?? 611 Mar 16? 2016 auth-static.conf.ext -rw-r--r-- 1 root root? 2185 Mar 16? 2016 auth-system.conf.ext -rw-r--r-- 1 root root?? 330 Mar 16? 2016 auth-vpopmail.conf.ext [T] jeff at nantes-1:conf.d $ sudo service dovecot restart Nov? 3 16:14:26 nantes-1 dovecot: master: Warning: Killed with signal 15 (by pid=5845 uid=0 code=kill) Nov? 3 16:14:26 nantes-1 dovecot: imap(jeff): Server shutting down. in=3514 out=2605 Nov? 3 16:14:26 nantes-1 dovecot: master: Dovecot v2.2.22 (fe789d2) starting up for imap, sieve (core dumps disabled) [T] jeff at nantes-1:conf.d $ No errors there, either. And, just to be clear that I'm not missing anything: ?? (master=)?? ? [T] jeff at nantes-1:p27 $ netstat -a | grep 242 ?? (master=)?? ? 1,[T] jeff at nantes-1:p27 $ doveconf -n | grep stat ?? (master=)?? ? 1,[T] jeff at nantes-1:p27 $ The file 91-stats contains the contents I pasted in my earlier mail.? I'm a bit unclear what to check next. Jeff On 03/11/17 08:06, Steffen Kaiser wrote:> On Thu, 2 Nov 2017, Jeff Abrahamson wrote: > > > In particular, nothing listens on 24242. > > >???? service stats { > >?????? inet_listener { > >???????? address = 127.0.0.1 > >???????? port = 24242 > >?????? } > >???? } > > my conf looks almost identitical. This should do the trick, IMHO. > > check "doveconf -n" to see, if you have a typo somewhere or any errors > show up. Second check out the error log (there might be (re)bind > failures). Third, make sure you have restarted Dovecot. > > -- Steffen Kaiser-- Jeff Abrahamson +33 6 24 40 01 57 +44 7920 594 255 http://p27.eu/jeff/