|
||||||||||||||||||||||||
Part
16 - QmailAnalog w/qlogtools & qms-analog |
||||||||||||||||||||||||
Qmailanalog performs some basic log analysis on those qmail log files and then outputs them to a desired location. In my case, I run qmailanalog every night and output the results to e-mail. Along with qmailanalog, we're going to install the "qlogtools" package. Qlogtools, as its name implies, provides an array of tools which can be used to analyze the qmail logs. We're going to use one of the qlogtool packages, tai64n2tai, to convert the timestamps on the log files from a machine readable format to a human readable format which will come to us when we get the finished report. After we've installed both Qmailstats and Qlogtools, we will create a script which you can run on a nightly basis to generate e-mail stats. The script will also incorporation qms-analog, which we installed with qmail-scanner previously. The qms-analog output will give add qmail-scanner stats to our nightly report. First, let's install qmailanalog... cd /downloads/qmailrocks/ gunzip qmailanalog-0.70.tar.gz tar xvf qmailanalog-0.70.tar cd qmailanalog-0.70 make && make setup check That's it. Qmailanalog is installed! Now let's install qlogtools... cd /downloads/qmailrocks/ gunzip qlogtools-solaris-3.1.tar.gz tar xvf qlogtools-solaris-3.1.tar cd qlogtools-solaris-3.1 mkdir /usr/local/man (if directory already exists, you're good to go) make ./installer OK. The qlogtools library of tools should now be installed. Now we will implement a script to run Qmailanalog and then you can hook that script into the server's crontab to get stats generated every night. The script below is a solid script that sends an email to the server administrator with both the qmailanalog output as well as qms-analog's readout of qmail-scanner's activities. Pretty sweet, huh? vi /var/qmail/bin/qmailstats #!/bin/sh DATE=`date +'%D'` echo
"To: postmaster@yourdomain.com"
> $EMAILMSG rm
-f $QMAILSTATS Now set the script executable... chmod 750 /var/qmail/bin/qmailstats Now run the script... /var/qmail/bin/qmailstats Check your email and you should get a report with some pretty cool stuff in it! Your report should look something like this. OK, if the qmailstats script is working, you will now want to create a crontab entry to run this script every night. So, as the "root" user let's set up a cron entry... crontab -e 0 3 * * * /var/qmail/bin/qmailstats 1>/dev/null 2>/dev/null Save and exit from the crontab editor and you should be all set. The above entry will run the qmailstats script every night at 3:00AM.
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
home | about | the installation | scripts & utilities | faq | contact | links | donations | journal | mailing list | list archive | qmr forum |
||||||||||||||||||||||||
This mirror last modified:
Thursday, August 9th, 2012 15:59:38 CEST
|
||||||||||||||||||||||||