I wanted to use apachetop to monitor one of my servers in real time. Much like top, apachetop reads the acces_log file in /var/logs/httpd/ and displays the results as apache processes happen.
Rather than installing apachetop from source, I thought a simple command like
yum install apachetop
should to the trick… but it doesn’t work by default. Now what?
Well an install via yum will only work if it is configured to look in the right repositories. Apachetop however is not part of the standard repos, hence we need to add what’s known as the EPEL package to yum (it stands for Extra Packages for Enterprise Linux).
In this article I’ll show you how to do it and how to run apachetop.
First you need to know which version of Centos you’re running (currently CentOS 5.x or 6.x). You can find out using this command:
You’ll also need to know if you’re running the 32-bit or 64-bit version of the OS. Find out by checking your kernel version via
Check the last two digits of the output: i386 would mean 32-bit, x86_64 would mean 64-bit.
With all that info at hand, let’s install EPEL. There are several mirrors out there, some of them are working and some of them are not.
The official ones maintained by The Fedora Project are not working anymore, you can find them in the link below. But thanks to Blueapple’s Livejournal the following ones should do the trick!
Issue the following command while being logged on as root:
CentOS 5 / 32-bit
rpm -Uvh http://mirror.chpc.utah.edu/pub/epe<wbr>l/5/i386/epel-release-5-4.noarch.rpm</wbr>
CentOS 5 / 64-bit
rpm -Uvh http://mirror.chpc.utah.edu/pub/epe<wbr>l/5/x86_64/epel-release-5-4.noarch.rpm</wbr>
CentOS 6 / 32-bit
rpm -Uvh http://mirror.chpc.utah.edu/pub/epel/6/i386/epel-release-6-7.noarch.rpm
CentOS 6 / 64-bit
rpm -Uvh http://mirror.chpc.utah.edu/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
Once installed, yum will be able to look in EPEL and find other packages, such as the one we’re after. Let’s go and install apachetop now:
yum install apachetop
How to use apachetop
You invoke it by just typing
or if you’d like to specify a file other than /var/log/httpd/access_log (which is the default) with
apachetop -f /path/to/file
You can quit back to the command prompt as usual with CTRL-C.
Have fun and enjoy