Release
 
Extra Options - Qmailmrtg

Ok, so now we're going to install qmailmrtg. In order for qmailmrtg to work right, however, were going to need 4 key pieces of software installed on our server. Most out-of-box Redhat servers already have these puppies installed, but if your's doesn't you will need to install them. Fortunately, Redhat has RPMs for all of them that I've never had any problems with.

You will need to following software packages installed on your server before we install qmailmrtg:

zlib - a library for compressing graph files

libpng - the PNG graphic format library

gd - the graph drawing library

mrtg - the multi router traffic grapher. duh.

If you are unsure whether or not these are currently installed on your server, you can do a simple RPM search. For example, if I wanted to find out if "zlib" was installed, I would run the following command:

rpm -qa | grep zlib

If the output lists the "zlib" package, you're golden. The same method applies to the other 3 packages as well.

But what if I have to install them?

Calm down. It's no big deal. Just go get the RPMs from Redhat.com and install them. If you're a member of Redhat Network, like I am, and you are familiar with the "up2date" tool, you can install all of these RPMS automatically and horribly easily by running the following command:

up2date -i zlib gd libpng mrtg

If this is the first time you've ever installed software via "up2date", you're probably sitting there in shock right now saying to yourself, "Holy shit! Why the hell didn't I use this before???".

Note: If you're not a member of Redhat Network and you've never used the "up2date" tool, go grab a hammer and give yourself a few good whacks on the head. Then, go join Redhat Network and get with the plan man.

OK, so by now you should have all of the above packages installed. Now let's install and configure qmailmrtg...

First, you have to download qmailmrtg from Inter 7. Of course, I'm a nice guy so I've put a link to download it right here: http://www.inter7.com/qmailmrtg7/qmailmrtg7-4.0.tar.gz

You can download it directly to your server if you've got wget installed...

wget http://www.inter7.com/qmailmrtg7/qmailmrtg7-4.0.tar.gz

Now let's unpack it...

tar zxvf qmailmrtg7-4.0.tar.gz

cd qmailmrtg7-4.0

make

make install

Now we're going to create a directory in our servers website directory to server as the location for the qmailmrtg stats output...

mkdir /path/to/your/web/directory/qmailstats   (example: mkdir /var/www/html/qmailstats)

and now we copy some of the qmailmrtg files over to that new directory...

cp qmail.mrtg.cfg /path/to/your/web/directory/qmailstats   (example: cp qmail.mrtg.cfg /var/www/html/qmailstats/)

cp index.html /path/to/your/web/directory/qmailstats    (example: cp index.html /var/www/html/qmailstats/)

Now we'll go configure those files that we just copied over...

cd /path/to/your/web/directory/qmailstats   (example: cd /var/www/html/qmailstats/)

vi index.html and replace all instances of "FQDN" with your domain name. ("FQDN" = Fully Qualified Domain Name)

Now we're going to edit the qmail.mrtg.cfg file again and set the proper paths so that everything will work right..

vi qmail.mrtg.cfg

First, replace all instances of "FQDN" with your domain name.

Now we're going to set the proper logging paths for each of the Qmail functions listed in this file. Below, I've copied to entire contents of the file and highlighted areas that you will need to customize. The paths I've included should work just fine IF you've installed Qmail according to this site. If you haven't, you may have to adjust the paths accordingly..


WorkDir: /path/to/your/qmailstats/directory (Example: /var/www/html/qmailstats)
#############################################################

Title[msg]: mydomain.com - Messages
MaxBytes[msg]: 10000
AbsMax[msg]: 20000
Options[msg]: gauge
Target[msg]: `/usr/local/bin/qmailmrtg7 m /var/log/qmail/qmail-send`
(The path to the qmail-send logs)
PageTop[msg]: <B>mydomain.com Messages</B><br>
ShortLegend[msg]: msg
YLegend[msg]: msg
Legend1[msg]: Total Msg
LegendI[msg]: &nbsp;Deliveries:
LegendO[msg]: &nbsp;Attempts:
WithPeak[msg]: ymwd

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

Title[queue-size]: mydomain.com - Queue Size
MaxBytes[queue-size]: 10000
AbsMax[queue-size]: 100000
Options[queue-size]: gauge
Target[queue-size]: `/usr/local/bin/qmailmrtg7 q /var/qmail/queue` (This should reflect the path the Qmail's Queue)
PageTop[queue-size]: <B>mydomain.com Queue Size</B><br>
ShortLegend[queue-size]: Msg
YLegend[queue-size]: Msg
Legend1[queue-size]: Msg
LegendI[queue-size]: &nbsp;Msg:
LegendO[queue-size]: &nbsp;Unprocessed Msg:
WithPeak[queue-size]: ymwd

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

Title[concurrency]: mydomain.com - Local/Remote Concurrency
MaxBytes[concurrency]: 500
AbsMax[concurrency]: 10000
Options[concurrency]: gauge
Target[concurrency]: `/usr/local/bin/qmailmrtg7 c /var/log/qmail/qmail-send`
(The path to the qmail-send logs)
PageTop[concurrency]: <B>mydomain.com - Local/Remote Concurrency</B><br>
ShortLegend[concurrency]: Concurrency
YLegend[concurrency]: Concurrency
Legend1[concurrency]: Concurrency
LegendI[concurrency]: &nbsp;Local:
LegendO[concurrency]: &nbsp;Remote:
WithPeak[concurrency]: ymwd

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

Title[messstatus]: mydomain.com - Message Status
MaxBytes[messstatus]: 10000
AbsMax[messstatus]: 100000
Options[messstatus]: gauge
Target[messstatus]: `/usr/local/bin/qmailmrtg7 s /var/log/qmail/qmail-send`
(The path to the qmail-send logs)
PageTop[messstatus]: <B>mydomain.com - Message Status</B><BR>
ShortLegend[messstatus]: Msg
YLegend[messstatus]: Msg
Legend1[messstatus]: Msg
LegendI[messstatus]: &nbsp;Success:
LegendO[messstatus]: &nbsp;Failures:
WithPeak[messstatus]: ymwd

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

Title[bytes]: mydomain.com - Bytes Transfered
MaxBytes[bytes]: 200000
AbsMax[bytes]: 30000000
Options[bytes]: gauge
Target[bytes]: `/usr/local/bin/qmailmrtg7 b /var/log/qmail/qmail-send`
(The path to the qmail-send logs)
PageTop[bytes]: <B>mydomain.com - Bytes Transfered</B><br>
ShortLegend[bytes]: kB
YLegend[bytes]: kB
Legend1[bytes]: kB
LegendI[bytes]: &nbsp;kB:
LegendO[bytes]: &nbsp;kB:
WithPeak[bytes]: ymwd

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

Title[smtp]: mydomain.com - SMTP Concurrency
MaxBytes[smtp]: 100
AbsMax[smtp]: 500
Options[smtp]: gauge
Target[smtp]: `/usr/local/bin/qmailmrtg7 t /var/log/qmail/qmail-smtpd`
(The path to the qmail-smtpd logs)
PageTop[smtp]: <B>mydomain.com - SMTP Concurrency</B><BR>
ShortLegend[smtp]: SMTP
YLegend[smtp]: SMTP
Legend1[smtp]: SMTP
LegendI[smtp]: &nbsp;SMTP:
LegendO[smtp]:
WithPeak[smtp]: ymwd

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

Title[smtpad]: mydomain.com - SMTP Totals
MaxBytes[smtpad]: 1000
AbsMax[smtpad]: 10000
Options[smtpad]: gauge
Target[smtpad]: `/usr/local/bin/qmailmrtg7 a /var/log/qmail/qmail-smtpd`
(The path to the qmail-smtpd logs)
PageTop[smtpad]: <B>mydomain.com - SMTP Totals</B><BR>
ShortLegend[smtpad]: SMTP
YLegend[smtpad]: SMTP
Legend1[smtpad]: SMTP
LegendI[smtpad]: &nbsp;Allow:
LegendO[smtpad]: &nbsp;Deny:
WithPeak[smtpad]: ymwd

#-------------------------------------------------------------------
Title[pop3]: mydomain.com - POP3 Concurrency
MaxBytes[pop3]: 100
AbsMax[pop3]: 500
Options[pop3]: gauge
Target[pop3]: `/usr/local/bin/qmailmrtg7 t /var/log/qmail/qmail-pop3d`
(The path to the qmail-pop3d logs)
PageTop[pop3]: <B>mydomain.com POP3 Concurrency</B><BR>
ShortLegend[pop3]: POP3
YLegend[pop3]: POP3
Legend1[pop3]: POP3
LegendI[pop3]: &nbsp;POP3:
LegendO[pop3]:
WithPeak[pop3]: ymwd

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

Title[pop3ad]: mydomain.com - POP3 Totals
MaxBytes[pop3ad]: 1000
AbsMax[pop3ad]: 10000
Options[pop3ad]: gauge
Target[pop3ad]: `/usr/local/bin/qmailmrtg7 a /var/log/qmail/qmail-pop3d`
(The path to the qmail-pop3d logs)
PageTop[pop3ad]: <B>mydomain.com - POP3 Totals</B><BR>
ShortLegend[pop3ad]: POP3
YLegend[pop3ad]: POP3
Legend1[pop3ad]: POP3
LegendI[pop3ad]: &nbsp;Allow:
LegendO[pop3ad]: &nbsp;Deny:
WithPeak[pop3ad]: ymwd

Ok, that's it for the configuration. Now all that's left to do is to run qmailmrtg to make sure it works, and then we'll set up a crontab to run it automatically for us on a regular basis.

To generate a qmailmrtg report, you use the following command:

/usr/bin/mrtg /path/to/qmailstats/qmail.mrtg.cfg (Example: /usr/bin/mrtg /var/www/html/qmailstats/qmail.mrtg.cfg)

Important Note! In order to get qmailmrtg running correctly, you will need to run it 3 times in a row the first time you use it. The first and second times you run it, you will see a bunch of output as qmailmrtg sets itself up. On the 3rd run there will be no output, which is how qmailmrtg will behave from then on.

Once you have run qmalmrtg 3 times, you should now be able to browse to http://www.yourdomain.com/qmailstats and you should see a nice graphical display of your mail server stats!

Hint: You may want to password protect the qmailstats area. Use .htaccess to do that.

I ran qmailmrtg like you said, but the graphs don't show anything!!! What's wrong?

Nothing's wrong. Qmailmrtg will only start to graph your stats from the time your first run it forward. It won't go back and pull stats from before you ran it. The key here now is to set up a crontab to run qmailmrtg every 5 minutes. Once the crontab is running, you should start to see some stats show up on the graphs in about 15 minutes.

So now let's set up the crontab for qmailmrtg...

crontab -e

*/5 * * * * /usr/bin/mrtg /path/to/qmailstats/qmail.mrtg.cfg

Now save the crontab and you should be all set! Qmailmrtg will now run every 5 minutes and post all Qmail happenings to the graphs on the webpage! If you wait about 15-20 minutes, you should start seeing some activity on the graphs!

Woohoo! You're all done!

 


 

Color Coded Qmail Installation Key
 
Regular Black Text 
 Qmail installation notes and summaries by the author. Me talking.
 
Bold Black Text 
 Commands to be run by you, the installer.
 
Bold Maroon Text 
 Special notes for Redhat 9 users.
 
Bold Red Text 
 Vital and/or critical information.
 
Regular/Bold Purple text 
 Denotes helpful tips and hints or hyperlinks.
 
Regular Orange Text 
 Command line output.
Cp

Regular green text 

 Denotes the contents of a file or script.
home | about | the installation | utilities | faq | contact | journal | mailing list | list archive | forum | links | donatemerchandise
modified
This mirror last modified: Thursday, August 9th, 2012 15:58:19 CEST
 
The Rocks Project