1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Qmails logfiles, where are they?

Discussion in 'Plesk for Linux - 8.x and Older' started by xLnT, Oct 13, 2008.

  1. xLnT

    xLnT Basic Pleskian

    23
    57%
    Joined:
    Aug 10, 2008
    Messages:
    35
    Likes Received:
    0
    Hi!
    I'd like to retrieve some stats for outgoing mails.
    I use munin for monitoring stats.

    There is a plugin to munin called qmailsend, but i cant get it to work.
    It's written in perl and i don't have that much knowledge of that language.

    This is the script:

    #!/usr/bin/perl -w
    #
    # Plugin to show amount of individual outgoing smtp-replies per hour
    #
    # Contributed by Hakon Nessjoen <lunatic@cpan.org>
    #
    # Magic markers - optional - used by installation scripts and
    # munin-config:
    #
    #%# family=manual
    #%# capabilities=autoconf

    use strict;

    my $logpath = $ENV{'logpath'} || '/var/log/mail/';

    if (exists $ARGV[0]) {
    if ($ARGV[0] eq "autoconf") {
    if (-f "${logpath}current") {
    print "yes\n";
    exit 0;
    } else {
    print STDERR "no (Cannot find ${logpath}current. Please specify env.logpath)\n";
    exit 1;
    }
    }
    }

    my %responses;

    # '453' => 'You have no mail (atrn)',
    # '503' => 'Bad sequence of commands',

    my %descriptions = (
    '250' => 'Mail delivery ok',
    '421' => 'Service unavail or timeout',
    '441' => 'No established connection',
    '442' => 'Connection Died',
    '450' => 'Mbox unavail or greylist',
    '451' => 'Err processing or greylist',
    '452' => 'Insufficient storage space',
    '454' => 'TLS not available now',
    '472' => 'DNS transaction timeout',
    '500' => 'Unsolicited mail',
    '501' => 'Syntax error',
    '511' => 'Blocked or blacklisted',
    '522' => 'Mailbox full',
    '550' => 'Mailbox unavailable',
    '551' => 'User not local',
    '552' => 'Content or storage error',
    '553' => 'Mailbox name not allowed',
    '554' => 'Session failed or blocked',
    '557' => 'Too many duplicate msgs'
    );

    #open(DATA,"cat ${logpath}current $logpath\@* | perl -ne'm/Remote_host_said:_(\\d+)/ && print \$1.\"\n\";' | sort | uniq -c|");
    open(DATA,"grep -E '_\\(\\#4\\.4\\.1\\)|_\\(\\#4\\.4\\.2\\)|Remote_host_said:_' ${logpath}current | sed 's/_(\\#4\\.4\\.1)/\\/Remote_host_said:_441_/; s/_(\\#4\\.4\\.2)/\\/Remote_host_said:_442_/' | perl -ne'm/Remote_host_said:_(\\d+)/ && print \$1.\"\n\";' | sort -n | uniq -c|");
    while (<DATA>) {
    if (m/\s*(\d+)\s+(\d+)/) {
    $responses{$2} = $1;
    }
    }
    close(DATA);


    if (exists $ARGV[0]) {
    if ($ARGV[0] eq 'config') {
    print "graph_title Qmail outgoing SMTP replies\n";
    print "graph_args --base 1000 -l 0 \n";
    print "graph_vlabel replies/hour\n";
    print "graph_category Mail\n";
    print "graph_total Total\n" if (keys (%descriptions) > 1);
    print "graph_info This graph shows qmail-send transaction response codes.\n";
    print "graph_order res" . join(" res", sort by_code keys %descriptions) . "\n";
    foreach (sort by_code keys %descriptions) {
    my $name = 'res' . $_;
    print "$name.label ";
    print $_." ".$descriptions{$_}."\n";
    print "$name.min 0\n";
    print "$name.draw LINE1\n";
    }
    exit;
    }
    }

    foreach (sort by_code keys %descriptions) {
    #print "res$_.value ".int($responses{$_})."\n";
    if (exists $responses{$_}) {
    print "res$_.value $responses{$_}\n";
    }else{
    print "res$_.value 0\n";
    }
    }

    sub by_code {
    return $a cmp $b;
    }

    #--------------------------------------------


    Any one got an idea how to get it to work?
    I don't know where qmail stores its logfiles.

    Regards
    Magnus
     
  2. Blackbit@

    Blackbit@ Guest

    0
     
    You can try /usr/local/psa/var/log/mail, if it's a plesk-system, instead of

    my $logpath = $ENV{'logpath'} || '/var/log/mail/';

    If it's not there, also check the syslog.conf in /etc for facility mail.
     
  3. xLnT

    xLnT Basic Pleskian

    23
    57%
    Joined:
    Aug 10, 2008
    Messages:
    35
    Likes Received:
    0
    The script looks for a file called "current".
    Thats the logfile im looking for i guess..
    Any one know ehre its located?
    Running Debian 4 amd64.

    Regards
     
  4. Blackbit@

    Blackbit@ Guest

    0
     
    qmail uses current and previous in a standard-installation. The script looks for files, you don't have. In Plesk qmail is run under x/inetd, so you wont' find those files. I think you should look for antother script.
     
  5. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    You could create a symlink called current pointing to your maillog. On CentOS/RHEL/Fedora Plesk's maillog is /usr/local/psa/var/log/maillog. I don't know about Debian, I believe Plesk sits in /opt/psa on Debian instead of /usr/local/psa.

    I have contributed a qmailqstat plugin to Munin that monitors the qmail queue if you're interested: https://sourceforge.net/mailarchive...FA40B79A7C@lemonbit.nl&forum_name=munin-users
     
  6. xLnT

    xLnT Basic Pleskian

    23
    57%
    Joined:
    Aug 10, 2008
    Messages:
    35
    Likes Received:
    0
    The info i really needed was located in /var/log/mail.info ;)
    When i used that file, the script worked.

    Thx
     
  7. levelup

    levelup Guest

    0
     
    Thanks for all your post
     
Loading...