Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

Cacti On CentOS 4.4 Including The Plug-in Architecture

This guide will step you through the process of installing a functional Cacti installation on CentOS 4.4 including the Plug-in Architecture, which will allow you to expand your monitoring solution.

There may be other methods of achieving the same results as I will present here today, but for me, this works.

NOTE: This guide assumes that you already have a working LAMP server.  If not, then I suggest having a look at “The Perfect Setup – CentOS 4.4 (32-bit) by till”.

If your system was not setup using the guide from till, then I would suggest that you look at the following sections to ensure that you have the proper software installed to make this guide work for you:

  • Section 6 – Install Some Software
  • Section 11 – Apache2 With PHP

Update: I have been contacted and informed that the version of Net-SNMP being installed by YUM may not be working properly, so I have updated my guide. Now, both RRDTool and Net-SNMP will be installed from source.

Update: Updated to correct some issues with directory permissions, place the cron job under the cactiusers cron entry and also to eliminate an issue that some people reported when trying to compile RRDtool.

1 Download Cacti Source

As of this guide, the most recent version of Cacti is cacti-0.8.6j, so this is the one that we will work with.  I maintain a directory for files that I download to my system called “downloads”.  You may of course use whatever directory you see fit, but for the beginner, let’s create the directory and download Cacti.

cd /
mkdir downloads
chmod 755 downloads
cd downloads


2 Download the Plug-in Architecture

Again, we will be working in the ‘downloads’ directory, which you should still be in.  The current version of the Plug-in Architecture is v1.1.



3 Install Some Necessary Software

Before we begin building Cacti, we will need to install some software to meet dependencies.
First, let’s add the Dag Wieers repository which is necessary for some of the software.  This assumes that you are installing Cacti on CentOS 4.4. If you are using a different version, please check this page for the proper link to use after the ‘rpm –Uvh’ command.

rpm -Uvh
yum install freetype-devel libpng-devel libart_lgpl-devel php-gd php-mysql

Be sure, when prompted, to answer “y” to begin the installation process.


4 Compile RRDtool

In this step, we will download and compile RRDTool.

tar -xvzf rrdtool.tar.gz
cd rrdtool-1.2.23/
./configure –disable-tcl
make install

Create a symlink for RRDTool.

ln -s /usr/local/rrdtool-1.2.23/bin/rrdtool /usr/local/bin/rrdtool


5 Compile Net-SNMP

In this step, we will download and compile RRDTool.

tar -xvzf net-snmp-5.2.4.tar.gz
cd net-snmp-5.2.4

At this point, you will be prompted to answer a few questions. You can either accept the defaults or use the examples below as a guide:

SNMP version to use = “1”;

Contact = “Your name”;

Location = “Your location”;

Location to write logfile to = “Hit enter for the default”;

Location of write persistant iinformation = “Hit enter for the default”;

make install


6 Extract Cacti

In this step, we will extract Cacti, move it to a new directory and create a symlink to your web root.

tar -xvzf cacti-0.8.6j.tar.gz
cp -Rf cacti-0.8.6j /usr/local/cacti
ln -s /usr/local/cacti /var/www/html


7 Extract Plug-in Architecture and patch Cacti

Before we begin the Cacti installation process, let’s extract the Plug-in Architecture and patch the Cacti files.

tar -xvzf cacti-plugin-arch.tar.gz
cp cacti-plugin-arch/cacti-plugin-0.8.6j.diff /usr/local/cacti/
cd /usr/local/cacti/

Now, let’s test the patch to ensure that everything is set up properly by performing a dry run on the patching process.  You do this, by issuing the command:

patch -p1 -N –dry-run < cacti-plugin-0.8.6j.diff

If no errors are returned, let’s go ahead and patch Cacti.  Issue the following command to do so:

patch -p1 -N < cacti-plugin-0.8.6j.diff


8 Edit config.php to set the proper URL path and user settings

nano include/config.php

Let’s go ahead and set up our database connection information:

Press CTRL-W to enter search mode. In the search window, enter:

$database_password = “cactiuser”;

Now that our search query is pasted in, hit the enter button to execute our query. Once found, replace it with:

$database_password = “cactipw”;

Now, we need to search for and replace $config[‘url_path’] = ‘/’;

Press CTRL-W to enter search mode. In the search window, enter:

$config[‘url_path’] = ‘/’;

Replace this line with:

$config[‘url_path’] = ‘/cacti/’;

Press CTRL-O to write out your changes, press enter to save the changes and CTRL-X to exit the nano editor.

9 Create the MySQL Database and the Cacti user.

In this step, we create the Cacti user and group.

groupadd cacti
useradd -g cacti cactiuser
usermod -G cacti cactiuser

Now, we will create the database and grant permissions on it as needed.

mysql -u root -p

Enter your password and at the MySQL prompt, enter the following commands:

create database cacti;
grant all on cacti.* to root;
grant all on cacti.* to root@localhost;
grant all on cacti.* to cactiuser;
grant all on cacti.* to cactiuser@localhost;
set password for cactiuser@localhost=password(‘cactipw’);

Finally, let’s import the SQL file that will create the tables (remember that you will need to use your MySQL password to complete this command):

cd /../downloads/cacti-0.8.6j
mysql -uroot -p cacti < cacti.sql


10 Set permissions on Cacti directories

Now we need to set some permissions to allow Cacti to function properly:

cd /../usr/local/cacti
chown -R cactiuser rra/ log/
chgrp apache log/cacti.log
chmod g+w log/cacti.log


11 Implement CRON job for Cacti poller

We’re almost done with the manual configuration.  Our last step is to schedule the Cacti poller to run every five minutes.

su cactiuser
crontab -e

Now, press “Esc I” to enter edit mode within the vi editor and paste the following:

*/5 * * * * cactiuser /usr/bin/php /usr/local/cacti/poller.php > /dev/null 2>&1

Note: Be sure that when you paste this line into crontab, that it is all on one line.  I’m not sure if it is a formatting issue or what, but sometimes when I paste it in, it wants to break off and place the “/dev/null 2>&1” section on a separate line which will cause the poller to fail.

Press the “Esc” key once to exit edit mode and then type the following and hit then enter key:


Before moving on, let’s verify that your crontab looks correct.  The following command will show you the contents of your cron job.

crontab -l

If everything looks good, then you can exit the cactiuser account and go back to the account you were previously working with. For example, if you were root, you would type the following:

su root


12 Install Cacti

We are finally at the area where we begin to pull it all together.  In the browser of your choice (most likely on another machine, unless you have opted for an X Window System on your server), enter your servers address into the address bar:

http://server IP address/cacti/

If you do have an X Windows system on your server, you could simply go to:


On the first screen, click “Next”.

One the second screen, ensure that “New Install” is selected and click “Next”.

On the third screen ensure that your paths match the ones shown below and that there are no errors.  If you do see any errors or have paths not found, double check to ensure that you have installed everything, otherwise click on the “Finish” button.

RRDTool Binary Path: /usr/bin/rrdtool
PHP Binary Path: /usr/bin/php
snmpwalk Binary Path: /usr/bin/snmpwalk
snmpget Binary Path: /usr/bin/snmpget
snmpbulkwalk Binary Path: /usr/bin/snmpbulkwalk
snmpgetnext Binary Path: /usr/bin/snmpgetnext
Cacti Log File Path: /usr/local/cacti/log/cacti.log
SNMP Utility Version: NET-SNMP 5.x
RRDTool Utility Version: RRDTool 1.2.x

At the login screen, the first time login is:

Username: admin
Password: admin

You will now be forced to change your password.

One final step is to change the settings for the RRDTool Default Font Path within Cacti to the proper setting.  Under the ‘Configuration’ section of the Cacti menu, you should see a link for ‘Settings’.  Now click on the ‘Paths’ tab and midway down the page, you should see ‘RRDTool Default Font Path’. In this area, enter the following:


Now click on the save button.

You should now have a fully functioning Cacti installation, although it will take a few minutes for the graphs to populate (they will not show images until the poller has run).

For additional information on how to expand your monitoring solution, I recommend the following sites:

Cacti –
Cactiusers –