How to install MRTG on Your Cpanel Server
The Multi Router Traffic Grapher or just simply MRTG is free software for monitoring the traffic load on network links. It allows the user to see traffic load on a network over time in graphical form. MRTG generates HTML pages containing graphical images which provide a LIVE visual representation of this traffic. How does it work? MRTG uses the Simple Network Management Protocol (SNMP) to send requests with two object identifiers (OIDs) to a device. The device, which must be SNMP-enabled, will have a management information base (MIBs) to lookup the OID's specified. After collecting the information it will send back the raw data encapsulated in an SNMP protocol. MRTG records this data in a log on the client along with previously recorded data for the device. The software then creates an HTML document from the logs, containing a list of graphs detailing traffic for the selected device.
This is a "How to" for installing MRTG (2.9.17) on a cpanel server. Let's start:
# Download the software (MRTG - Tobi Oetiker's MRTG - The Multi Router Traffic Grapher) and move it to your download folder on your server. Or use the RPM installation information further down below.
cd /root/downloads
# Unninstall any older version in case we have an old/broken installation
rpm -e mrtg
# Get the latest rpm. The RPM might not reflect the latest available stand-alone version
wget http://www.dedicated-resources.com/f...panel.i386.rpm
# Or grab a newer version from here: RPM resource mrtg
# Installing the application
rpm -Uvh mrtg-2.9.17-1cpanel.i386.rpm
# Moving libpng
cd /usr/lib
mv libpng.so.2 libpng.so.2.OLD
# Creating the symlink
ln -s libpng.so.3 libpng.so.2
# Edit language at and specify only "en_US"
pico /etc/sysconfig/i18n
# Restarting MRTG
service mrtg restart
# Configure MRTG to allow only your local IP to see the reports at http://ip/mrtg - Important: If your local IP changes due to DHCP very often, you should skip this step.
# This can be happening often when being on DSL.
pico /usr/local/apache/conf/httpd.conf
#Search for the line (CTRL+W):
# It should look like this:

Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all

#After the last line () paste this and change allowed IPs:

order deny,allow
allow from [ SERVER IP ]
allow from [YOUR LOCAL IP]
deny from all

# Restarting httpd
service httpd restart
# Let's put MRTG to start with the system
chkconfig --level 0123456 mrtg on
# Important: Add MRTG to the up2date skip-list of your server. If you don't do this, after the system updates your MRTG installation will be broken.
up2date --configure
# Select the skip-list option
# Add mrtg to the skip-list
"mrtg*"

After this final step, your MRTG report should be available at: http://server_ip/mrtg