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 (http://oss.oetiker.ch/mrtg/) and move it to your download folder on your server. Or use the RPM installation information further down below.
# 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
# Or grab a newer version from here: http://rpmfind.net/linux/rpm2html/search.php?query=mrtg
# Installing the application
rpm -Uvh mrtg-2.9.17-1cpanel.i386.rpm
# Moving libpng
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"
# 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.
#Search for the line (CTRL+W):
# It should look like this:
Options Indexes FollowSymlinks MultiViews
Allow from all
#After the last line () paste this and change allowed IPs:
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.
# Select the skip-list option
# Add mrtg to the skip-list
After this final step, your MRTG report should be available at: http://SERVER_IP/mrtg