QMAILANALOG & QLOGTOOLS
QMAILANAlog performs some of the most basic analysis for qmail's logs and sends the results to your specified location. In my solution, set qmailanalog running every night and send the results to the administrator. When using qmailanalog, we will also use the QLogTools package.
QlogTools offers a range of tools to analyze QMAIL logs that convert the logs that are unknown in the file into a report that we read and understand. When you have completed qmailstats and qlogtools, I will create a script to make it run every night and send the report to management.
Email the mailbox. This script can also be used by our previously installed QMS-Analog, QMS-Analog will provide QMail-Scanner run status reports.
# Qmailanalog first
CD / Home / PKG /
TAR ZXVF qmailanalog-0.70.tar.gz
CD qmailanalog-0.70
Patch
Make && Make Setup Check
# Install QLogTools
CD / Home / PKG /
TAR ZXVF QlogTools-3.1.tar.gz
CD Qlogtools-3.1
PATCH
Make
./installer
# Now we have to create a script and add it to cron to run and generate reports every night.
# The following is a reliable script that will collect information from QMAILANAlog and generate reports.
# 红 部 份 成.
Vi / var / qmail / bin / qmailstats
#! / bin / sh
# Qmailanalog invocation script
Path = / usr / local / qmailanalog / bin: / var / qmail / bin: / bin: / usr / bin: / usr / local / bin
Qmailstats = "/ tmp / q. $$"
Emailmsg = "/ TMP / QMS. $$"
Umask 077
CAT / var / log / qmail / * / var / log / qmail / pop3d / * / var / log / qmail / pop3ds / * / var / log / qmail / smtpd / * | TAI64N2TAI | awk '{$ 1 = Substr ($ 1 , 1, Index ($ 1, ") 6); Print} '| Matchup> $ qmailstats 5> / dev / null
Date = `Date '% d'`
echo "to: postmaster @
YourDomain.com "> $ EMAILMSG
echo "from: postmaster @
YourDomain.com ">> $ emailmsg
Echo "Subject: Nightly Qmail Stats Report for $ DATE >> $ EMAILMSG
Echo "" >> $ emailmsg
Echo "" >> $ emailmsg
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ">> $ Emailmsg
Zoverall <$ qmailstats >> $ emailmsgecho ">> $ emailmsg
Echo "" >> $ emailmsg
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ">> $ Emailmsg
Zfailures <$ qmailstats >> $ Emailmsg
Echo "" >> $ emailmsg
Echo "" >> $ emailmsg
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ">> $ Emailmsg
Zdeferrals <$ qmailstats >> $ Emailmsg
Echo "" >> $ emailmsg
Echo "" >> $ emailmsg
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ">> $ Emailmsg
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ ">> $ emailmsg
Cat /var/spool/qmailscan/qms-events.log | QMS-ANALOG 24 >> $ Emailmsg
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ">> $ Emailmsg
Echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ ">> $ Emailmsg
Cat /var/spool/qmailscan/qms-events.log | QMS-ANALOG 0 >> $ EMAILMSG
Cat $ Emailmsg | qmail-inject
RM -F $ qmailstats
RM -F $ EMAILMSG
# Set this script to be executed
CHMOD 750 / VAR / QMAIL / BIN / QMAILSTATS
# 现在 现在, let us run the script
/ VAR / QMAIL / BIN / QMAILSTATS
# Confirm your administrator email, you will receive a very detailed report.
# If the test is running normally, then CRON will be joined to run at 3 o'clock in the morning.
Crontab -e
0 3 * * * / var / qmail / bin / qmailstats 1> / dev / null 2> / dev / null