MDLog:/sysadmin

The Journal Of A Linux Sysadmin

Enable Sendmail Mailstats

| Comments

Running mailstats on a debian etch server running sendmail was returning the following error:

1
2
3
4
5
# /usr/sbin/mailstats
MSP statistics...
mailstats: /var/lib/sendmail/sm-client.st: No such file or directory
MTA statistics...
mailstats: /var/lib/sendmail/sendmail.st: No such file or directory

The StatusFile was enabled in sendmail.cf (the default location as no definition was overwritten in sendmail.mc):

1
2
# grep StatusFile /etc/mail/sendmail.cf
O StatusFile=/var/lib/sendmail/sendmail.st

Still this was not working… In order to have this working we have to touch the status files (the ones defined in sendmail.cf and submit.cf):

1
2
# touch /var/lib/sendmail/sm-client.st
# touch /var/lib/sendmail/sendmail.st

After this (sendmail restart is not needed), sendmail will start loging information to the files and the mailstats command will start working properly:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#mailstats
MSP statistics...
Statistics from Fri Aug 22 13:47:40 2008
M   msgsfr  bytes_from   msgsto    bytes_to  msgsrej msgsdis msgsqur  Mailer
=====================================================================
T        0          0K        0          0K        0       0       0
C        0                    0                    0
MTA statistics...
Statistics from Fri Aug 22 13:46:36 2008
M   msgsfr  bytes_from   msgsto    bytes_to  msgsrej msgsdis msgsqur  Mailer
3       56         70K        2          4K        0       0       0  local
5        6        129K       75        224K        0       0       0  esmtp
=====================================================================
T       62        199K       77        228K        0       0       0

If you want to reset this information from time to time you should call in a cron job:

1
mailstats -p > /dev/null

Comments