Postfix Monitoring With Mailgraph And pflogsumm On Debian Etch

Discussion in 'HOWTO-Related Questions' started by klonos, Aug 20, 2007.

  1. klonos

    klonos New Member

    Hey falko does this Howto work with "Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 6.10 Edgy Eft)"???

    I did try it and I am having the following issues (sorry for the long story):

    1. I executed:

    from the command prompt and I did receive one or two stat reports. So, I thought it would work fine as a cronjob too. After a day or two I stoped receiving them and I got a "Considered UNSOLICITED BULK EMAIL, apparently from you" email instead:

    So I think that the stats are blocked as spam. Am I right on this one?

    So after some research/reading/googling I found out that I need to use the amavid-release command in order to get quarantined (false positive) mail delivered to its final receipient.

    So I did:

    So it didn't take me log to realise that there was nothing wrong with the way I was typing the filename of the mail I wanted to release. Tried to release some other spam and had the same error. Can you please tell me how to have this email (or any email) released?

    2. I also received a "Cron <root@mail> /usr/local/sbin/postfix_report.sh &> /dev/null" mail.

    First it said:

    did an ls in /var/log and saw that there were only the files:

    - mail.log
    - mail.log.0
    - mail.log.1.gz
    - mail.log.2.gz
    - mail.log.3.gz
    - mail.log.4.gz
    - mail.log.5.gz
    - mail.log.6.gz

    but no mail.log.0.gz

    So, I edited /usr/local/sbin/postfix_report.sh to read:

    Because I thought that since the mail.log.0 file is already gunziped it did not need to be done twice. In fact I believe that this was what caused the error. I also commented the gzip line since no gzipping was needed either.

    After a day I got a mail with the same subject but this time it said:

    How do I resolve this one? What am I doing wrong?

    3. The Mailgraph is not working either. I gave it some time to collect data for a day or two, but instead of graphs I see a "mailgraph" string when I browse http://mail.domain.net/cgi-bin/mailgraph.cgi
     
  2. falko

    falko Super Moderator Howtoforge Staff

    I think you can specify your local domain somewhere in the amavisd configuration so that mails from this domain won't be considered as spam.

    Did you configure logrotate as shown in the tutorial?

    I think the directory where the graphs should be created isn't writable. What's in your mailgraph.cgi (in the beginning)?
     
  3. klonos

    klonos New Member

    Yes, I will look into this, but what I really want is a way to release other mail as well. amavisd-release doesn't seem to work and keeps spitting:

    no matter what spam false positive I try to release.

    I double-checked it. here it is:

    Here is what is in the begging of my mailgraph.cgi:

    I've checked my /var/lib/mailgraph directory and it only contains a directory ,cgi-bin. The /var/lib/mailgraph/,cgi-bin directory is also empty.

    Here is a permissions listing:

     
  4. falko

    falko Super Moderator Howtoforge Staff

    Can you try
    Code:
    chmod -R 777 /var/lib/mailgraph
    ?

    What's the output of
    Code:
    updatedb
    locate amavisd.sock
    ?
     
  5. klonos

    klonos New Member

    Ok, changed perimisions and verified:

    Lets let it collect some data for a day or two and I'll let you know. By the way... is it normal for that cgi-bin directory in /var/lib/mailgraph to have the comma in the beggining of its filename?? ...Just a thought.

    There is no file or directory by that name on the drive:

    Here is a list of all amavisd files found though. Hope it helps:

     
  6. klonos

    klonos New Member

    Ok, I've had some progress regarding the issue with the amavisd-release giving:

    Code:
    Can't connect to UNIX socket /var/run/amavis/amavisd.sock: No such file or directory at /usr/sbin/amavisd-release line 191.
    error. There is no /var/run/amavis/amavisd.sock file, but there is a /var/run/amavis/amavis.sock.

    So, I changed /usr/sbin/amavisd-release from:

    Code:
    [...]
    
      $log_level = 1;
    # $socketname = '127.0.0.1:9998';
    $socketname = '/var/run/amavis/amavisd.sock';
    
    [...]
    to

    Code:
    [...]
    
      $log_level = 1;
    # $socketname = '127.0.0.1:9998';
    # $socketname = '/var/run/amavis/amavisd.sock';
    $socketname = '/var/run/amavis/amavis.sock';
    
    [...]
    Now everything seems to be working ok!

    Also playing around with the mail.log.[x].gz files (renaming a few of them) and re-enabling the gunzip/gzip lines in /usr/local/sbin/postfix_report.sh got my mail stats working!!

    In other words, 2 issues solved, 1 remains. That seems to be going pretty well. Lets see if we will get mailgraph working.
     
  7. falko

    falko Super Moderator Howtoforge Staff

    I've just read through this thread again. It seems that /var/lib/mailgraph/mailgraph.rrd and /var/lib/mailgraph/mailgraph_virus.rrd aren't existing.
    What's the output of
    Code:
    locate mailgraph.rrd
    locate mailgraph_virus.rrd
    ?
     
  8. klonos

    klonos New Member

    Yes, I was sure something like this would happen since I posted 3 issues at one thread. Sorry.

    Anyways... as I've already mentioned, my mailgraph dir contains nothing but a ,cgi-bin directory that is empty itself. (by the way should that comma be there in the first place??? or is it a typo)

    Here is what mailgraph files/dirs I have plus a listing of both
    /var/lib/mailgraph and /var/lib/mailgraph/,cgi-bin :

    as you can see, there are no rrd files. Also, those two dirs have full permisions since I've changed that during a previous troubleshooting step:

     
  9. falko

    falko Super Moderator Howtoforge Staff

    I *think* the comma is correct, but I'm not sure.

    The lack of the two .rrd files makes me think the mailgraph isn't running at all. Can you see it in the output of
    Code:
    ps aux
    ? Do you get any errors when you restart mailgraph?
     
  10. klonos

    klonos New Member

    Yes, once again you were right. A simple /etc/init.d/mailgraph start solved it. Now the two .rrd files are there as they should.

    It seems that each time I restart the server mailgraph doesn't auto-start though. So, how can I get it to start automatically everytime?
     
  11. falko

    falko Super Moderator Howtoforge Staff

    Try
    Code:
    update-rc.d mailgraph defaults
     
  12. klonos

    klonos New Member

    That did the trick! Thank you.

    One last thing though... I tried upgrading the mailgraph from 1.12 to 1.13 (from source) by replacing the /usr/lib/cgi-bin/mailgraph.cgi and /usr/sbin/mailgraph.pl and after I have updated the cgi code to point to the correct .rrd files I got the first graph (the one showing sent & received) for each day, week, month and year working, but the second graph (the one with spam, virus etc stats) could not show. All I am getting is a "mailgraph" placeholder instead. Any ideas? Are there any mailgraph logs I failed to locate in my drive?

    By the way (irrelevant to this thread), I now have another 2 servers to "play with", so if you were thinking of updating the "Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 6.10 Edgy Eft)" for 7.04 or 7.10 once it is out, let me know if I can help by testing, ok? You could also include things like this stats howto and a webmail (squirrelmail perhaps) installation as well to make it more complete. Also remember that I've found out during this troubleshooting that amavisd-release doesn't work out of the box and maybe a gui solution like MailZu would also be a plus. As I said, I am more than willing to help with testing.
     
  13. falko

    falko Super Moderator Howtoforge Staff

    Did it work prior to upgrading?
     
  14. klonos

    klonos New Member

    Yes it did and it still does. I mean this is how I worked around it. I revertted back to 1.12. I am just trying to upgrade to the newest version.

    PS. sorry for te late reply.
     

Share This Page