• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

Qmails logfiles, where are they?

xLnT

Basic Pleskian
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 <[email protected]>
#
# 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
 
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.
 
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
 
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.
 
The info i really needed was located in /var/log/mail.info ;)
When i used that file, the script worked.

Thx
 
Back
Top