|
||||||||||||||||||||||||
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..
Title[msg]:
mydomain.com - Messages #------------------------------------------------------------------- Title[queue-size]:
mydomain.com - Queue Size #------------------------------------------------------------------- Title[concurrency]:
mydomain.com - Local/Remote Concurrency #------------------------------------------------------------------- Title[messstatus]:
mydomain.com - Message Status #------------------------------------------------------------------- Title[bytes]:
mydomain.com - Bytes Transfered #------------------------------------------------------------------- Title[smtp]:
mydomain.com - SMTP Concurrency #------------------------------------------------------------------- Title[smtpad]:
mydomain.com - SMTP Totals #------------------------------------------------------------------- #------------------------------------------------------------------- Title[pop3ad]:
mydomain.com - POP3 Totals 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!
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
home | about | the installation | utilities | faq | contact | journal | mailing list | list archive | forum | links | donate | merchandise |
||||||||||||||||||||||||
This mirror last modified:
Thursday, August 9th, 2012 15:58:19 CEST
|
||||||||||||||||||||||||