initial commit of file from CVS for e-smith-qmailanalog on Wed 12 Jul 09:07:12 BST 2023
This commit is contained in:
0
root/etc/e-smith/events/e-smith-qmailanalog-update/.gitignore
vendored
Normal file
0
root/etc/e-smith/events/e-smith-qmailanalog-update/.gitignore
vendored
Normal file
98
root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/qmailanalog
Executable file
98
root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/qmailanalog
Executable file
@@ -0,0 +1,98 @@
|
||||
<!-- vim: ft=xml ts=8 sw=4 noet:
|
||||
-->
|
||||
<lexicon lang="en-us">
|
||||
<entry>
|
||||
<base>FORM_TITLE</base>
|
||||
<trans>Mail Log File Analysis</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>INITIAL_DESC</base>
|
||||
<trans>
|
||||
<![CDATA[
|
||||
<P>Analysing the mail system log files can aid both in
|
||||
understanding how your system is performing and in
|
||||
diagnosing delivery problems. Several different
|
||||
reports are available.</P>
|
||||
<P>Please note that it may take several minutes to generate
|
||||
these reports</P>
|
||||
]]>
|
||||
</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>REPORT_TYPE</base>
|
||||
<trans>Choose a report type</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>GENERATE_REPORT</base>
|
||||
<trans>Generate report</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>LIST_OUTGOING</base>
|
||||
<trans>List outgoing messages and recipients</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>SUMMARIZE_QUEUE</base>
|
||||
<trans>Summarize status of mail queue</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>SUCCESSFUL_DELIVERY_DELAY</base>
|
||||
<trans>Successful delivery delay distribution</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>REASONS_DEFERRAL</base>
|
||||
<trans>Reasons for deferral</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>REASONS_FAILURE</base>
|
||||
<trans>Reasons for failure</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>BASIC_STATS</base>
|
||||
<trans>Basic statistics</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>RECIP_STATS</base>
|
||||
<trans>Recipients statistics</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>RECIP_HOSTS</base>
|
||||
<trans>Recipient hosts</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>RECIP_ORDERED</base>
|
||||
<trans>Recipients in best order for mailing lists</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>SENDER_STATS</base>
|
||||
<trans>Sender statistics</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>SENDMAIL_STYLE</base>
|
||||
<trans>Sendmail style log</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>REASONS_SUCCESS</base>
|
||||
<trans>Reasons for success</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>SENDER_UIDS</base>
|
||||
<trans>Sender uids</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>INVALID_REPORT_TYPE</base>
|
||||
<trans>Invalid report type: </trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>REPORT_GENERATED</base>
|
||||
<trans>Report generated: </trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>END_OF_REPORT</base>
|
||||
<trans>End of Report</trans>
|
||||
</entry>
|
||||
<entry>
|
||||
<base>Mail log file analysis</base>
|
||||
<trans>Mail log file analysis</trans>
|
||||
</entry>
|
||||
|
||||
</lexicon>
|
62
root/etc/e-smith/web/functions/qmailanalog
Executable file
62
root/etc/e-smith/web/functions/qmailanalog
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/perl -wT
|
||||
|
||||
# vim: ft=xml ts=8 sw=4 noet:
|
||||
#----------------------------------------------------------------------
|
||||
# heading : Administration
|
||||
# description : Mail log file analysis
|
||||
# navigation : 4000 4500
|
||||
#
|
||||
# $Id: qmailanalog,v 1.6 2003/03/06 17:35:26 lijied Exp $
|
||||
#
|
||||
# copyright (C) 2002 Mitel Networks Corp.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use esmith::FormMagick::Panel::qmailanalog;
|
||||
|
||||
my $panel = esmith::FormMagick::Panel::qmailanalog->new();
|
||||
# Loosen up the path restriction imposed by esmith::FormMagick
|
||||
$ENV{PATH} = "/bin:/usr/bin:/usr/local/bin";
|
||||
$panel->display();
|
||||
|
||||
__DATA__
|
||||
<form title="FORM_TITLE" header="/etc/e-smith/web/common/head.tmpl"
|
||||
footer="/etc/e-smith/web/common/foot.tmpl">
|
||||
<page name="Initial" pre-event="turn_off_buttons">
|
||||
<description>INITIAL_DESC</description>
|
||||
<field id="report_type" type="select" value="zoverall"
|
||||
options="'qmail-qread' => 'LIST_OUTGOING',
|
||||
'qmail-qstat' => 'SUMMARIZE_QUEUE',
|
||||
'zddist' => 'SUCCESSFUL_DELIVERY_DELAY',
|
||||
'zdeferrals' => 'REASONS_DEFERRAL',
|
||||
'zfailures' => 'REASONS_FAILURE',
|
||||
'zoverall' => 'BASIC_STATS',
|
||||
'zrecipients' => 'RECIP_STATS',
|
||||
'zrhosts' => 'RECIP_HOSTS',
|
||||
'zrxdelay' => 'RECIP_ORDERED',
|
||||
'zsenders' => 'SENDER_STATS',
|
||||
'zsendmail' => 'SENDMAIL_STYLE',
|
||||
'zsuccesses' => 'REASONS_SUCCESS',
|
||||
'zsuids' => 'SENDER_UIDS'" validation="nonblank">
|
||||
<label>REPORT_TYPE</label>
|
||||
</field>
|
||||
<subroutine src="print_button('GENERATE_REPORT')"/>
|
||||
</page>
|
||||
<page name="Report" pre-event="generateReport">
|
||||
</page>
|
||||
</form>
|
0
root/etc/e-smith/web/panels/manager/cgi-bin/.gitignore
vendored
Normal file
0
root/etc/e-smith/web/panels/manager/cgi-bin/.gitignore
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
#!/usr/bin/perl -wT
|
||||
#
|
||||
# Copyright (C) 2002 Mitel Networks Corporation
|
||||
#
|
||||
# Technical support for this program is available from e-smith, inc.
|
||||
# Please call us at (613) 236-0743 or visit our web site www.e-smith.net
|
||||
# for details.
|
||||
#
|
||||
# $Id: qmailanalog.pm,v 1.5 2003/01/16 20:19:23 markk Exp $
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
package esmith::FormMagick::Panel::qmailanalog;
|
||||
|
||||
use strict;
|
||||
use esmith::FormMagick;
|
||||
use Exporter;
|
||||
our @ISA = qw(esmith::FormMagick Exporter);
|
||||
our @EXPORT = qw(generateReport);
|
||||
our @VERSION = sprintf '%d.%03d', q$Revision: 1.5 $ =~ /: (\d+).(\d+)/;
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
esmith::FormMagick::Panel::qmailanalog - useful panel functions
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use esmith::FormMagick::Panel::qmailanalog;
|
||||
my $panel = esmith::FormMagick::Panel::qmailanalog->new();
|
||||
$panel->display();
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
=head2 new ();
|
||||
|
||||
Exactly as for esmith::FormMagick
|
||||
|
||||
=begin testing
|
||||
|
||||
use_ok 'esmith::FormMagick::Panel::qmailanalog';
|
||||
$FM = esmith::FormMagick::Panel::qmailanalog->new();
|
||||
isa_ok($FM, 'esmith::FormMagick::Panel::qmailanalog');
|
||||
$FM->{cgi} = CGI->new;
|
||||
|
||||
=end testing
|
||||
|
||||
=cut
|
||||
|
||||
sub new
|
||||
{
|
||||
shift;
|
||||
my $self = esmith::FormMagick->new();
|
||||
$self->{calling_package} = (caller)[0];
|
||||
bless $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=head2 generateReport
|
||||
|
||||
Generate and display the requested report.
|
||||
|
||||
=begin testing
|
||||
|
||||
$FM->{cgi}->param(-name=>'report_type', -value=>'zoverall');
|
||||
$FM->generateReport();
|
||||
like($_STDOUT_, qr/REPORT_GENERATED/, 'generateReport');
|
||||
|
||||
=end testing
|
||||
|
||||
=cut
|
||||
|
||||
sub generateReport
|
||||
{
|
||||
my $self = shift;
|
||||
my $q = $self->{cgi};
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Verify the arguments and untaint the variables (see Camel
|
||||
# book, "Detecting and laundering tainted data", pg. 358)
|
||||
#------------------------------------------------------------
|
||||
|
||||
my $report_type = $q->param ('report_type');
|
||||
if ($report_type =~ /^(\S+)$/)
|
||||
{
|
||||
$report_type = $1;
|
||||
}
|
||||
elsif ($report_type =~ /^\s*$/)
|
||||
{
|
||||
$report_type = "zoverall";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $q->p($q->b($self->localise('INVALID_REPORT_TYPE').
|
||||
$report_type));
|
||||
return '';
|
||||
}
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Looks good; go ahead and generate the report.
|
||||
#------------------------------------------------------------
|
||||
|
||||
# $| = 1;
|
||||
|
||||
my $now_string = $self->gen_locale_date_string();
|
||||
print $q->h3($self->localise('REPORT_GENERATED'), $now_string);
|
||||
|
||||
if ($report_type =~ /^qmail-q/)
|
||||
{
|
||||
open(QMAILQUEUEREPORT, "/var/qmail/bin/$report_type |");
|
||||
|
||||
print "<pre>\n";
|
||||
|
||||
while (<QMAILQUEUEREPORT>)
|
||||
{
|
||||
print;
|
||||
}
|
||||
|
||||
close QMAILQUEUEREPORT;
|
||||
print "</pre>\n";
|
||||
|
||||
print $q->h3($self->localise('END_OF_REPORT'));
|
||||
return '';
|
||||
}
|
||||
|
||||
chdir "/var/log/qmail";
|
||||
|
||||
open(QMAILANALOG,
|
||||
"/bin/cat \@* current 2>/dev/null"
|
||||
. "| /usr/local/bin/tai64nunix"
|
||||
. "| /usr/local/qmailanalog/bin/matchup 5>/dev/null"
|
||||
. "| /usr/local/qmailanalog/bin/$report_type |"
|
||||
);
|
||||
|
||||
print "<pre>\n";
|
||||
|
||||
while (<QMAILANALOG>)
|
||||
{
|
||||
# Cook any special HTML characters
|
||||
|
||||
s/\&/\&/g;
|
||||
s/\"/\"/g;
|
||||
s/\>/\>/g;
|
||||
s/\</\</g;
|
||||
|
||||
print;
|
||||
}
|
||||
|
||||
print "</pre>\n";
|
||||
|
||||
close QMAILANALOG;
|
||||
|
||||
print $q->h3($self->localise('END_OF_REPORT'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
Reference in New Issue
Block a user