On this page

Cacti With Xampp On Ubuntu

This is a simple setup of Cacti, so that you don’t really need a "Linux" expert to maintain it. Please note that Cacti can also be installed
on Windows and guides for both these installations are available on the
net. This guide is just a repeat of how Cacti was set up here in Mumbai.

Cacti was primarily set up to monitor backhauls and have ready graphs
whenever we need, but currently we are also using it to monitor CPU
usage, memory usage, see traffic patterns, get alerts etc.

So now we go on to the basic setup.

Requirements:

One Linux machine - (can be any depending on your choice; try and
keep at least 256mb ram, I have tested Cacti on a 1.4ghz processor and
256 mb ram, with centos as the operating system and with around 350
monitored devices, and it has run without a hitch for more than a
month, currently Cacti resides on a 1.8ghz machine with 512 mb ram,
which is also running a proxy server - squid, plus an intranet web ftp
server).

RRDtool - this is the defacto package used by 95% of all NMS tools out on the net for graphing, details can be found at http://oss.oetiker.ch/rrdtool/.

Xampp - now the reason I am going in for Xampp is because it lets
maintain a lot of things very easily (the Apache webserver - MySQL
database, PHP programming language and all needed dependencies); of
course we can do it without Xampp but you can search for those docs on
the net.

Note: there is a server version of Ubuntu which is also available but we will not be going in for that due to lack of gui.

2: Once downloaded burn it onto a CD and then boot the machine you have decided to make as your server with the same CD.

3: Once the machine boots up, you will notice that it is running in Live-CD mode, i.e. the hard disk is not being used, you will find an
Install icon on the top left of your screen, double-click on it and go
ahead with the installation, the only problem you might have is during
partitioning - as we are going in for a separate machine it's best that we
go in for auto partitioning (a detailed Ubuntu install guide is not
really possible right now but it can be found here: https://help.ubuntu.com/6.10/ubuntu/installation-guide/i386/index.html.

Also remember to type in your username to be used as deadwait (im taking deadwait just for this example).

4: Once Ubuntu is installed - all further steps will now occur from
within Ubuntu itself, the next thing to do is see to it that it is
updated. For that we have to have access to the Internet hence your
network card will have to be configured, I hope you remember the root
password you had supplied during the installation.

5.1: Now assuming you have downloaded the file to /opt you need to
do the foll next (I'm going to be guiding you in command line mode -
but it can be done in GUI, the reason I haven't mentioned the GUI method is because I get confused in GUI mode, as these DOCS will be open for editing later anyone who wishes to update the GUI mode can do so).

As usual click on:

Applications --> Accessories --> Terminal

Type in:

cd /opt

This will bring you in the /opt directory, type in:

sudo tar -xvzf xampp-linux-1.6.3b.tar.gz

What this does is unzip/unpack the file into its own directory, if
you type in the command dir you will now see that a new directory
(lampp) has been created. If you want to delete the
xampp-linux-1.6.3b.tar.gz file or not is up to you, if you want to
delete it the command is:

sudo rm -rf xampp-linux-1.6.3b.tar.gz

What I do is usually move these files in to my home folder, assuming
my login name is deadwait then my home folder becomes /home/deadwait, the command
to move the file is as follows:

sudo mv xampp-linux-1.6.3b.tar.gz /home/deadwait

Now for the cool part –> in the same terminal type in:

cd lampp

Then type in:

sudo ./lampp start

and your webserver along with MySQL and FTP will have started, to check the same, open up Firefox and type in http://localhost, you should get the Xampp screen.

5.2: Now let's clear some basic stuff we need to do - you see Cacti
needs a database which we have already installed using Xampp, now what
we need to do is create Cacti's own database. Now since you have opened
up http://localhost in Firefox, Xampp will ask you its language preference, click on English, then on the left pane you will see a link for phpmyadmin, click on it, what you see now is a web based administration tool for MySQL, on the first page itself you will see an option named Create Database. In the field below type in cacti
since this is the name we will use for our database (of course, you
could name it whatever you want). Then go on to the next step.

6: So then, one part of our work is done. Next thing to do is to
install rrdtool. You're going to love this, in a terminal box type in the
magic commands:

sudo aptitude install rrdtool

and that's it. rrdtool is installed (now for a bit of history, we can
install the entire Cacti along with webserver, PHP and MySQL by doing sudo
aptitude install cacti, but we haven't done that because if you are not
comfortable with Linux it could lead to a lot of confusion as to where
the files are installed, also the package could break if an upgrade
takes place).

At the same time let's install one more tool needed (which is snmp) with the same command:

sudo aptitude install snmp

and then:

sudo aptitude install snmpd

What is important to remember is rrdtool gets installed in /usr/bin/rrdtool, we will need this path later.

Save the link on your e.g.: Desktop, then open up a terminal and
navigate to your desktop, the commands are (assuming your user login is
deadwait):

cd /home/deadwait/Desktop

Remember Linux is case-sensitive, so desktop won't work, it will be Desktop. Once we are in Desktop, type in the foll commands:

sudo tar -xvzf cacti-0.8.6j.tar.gz

which will extract the foll in a directory named cacti-0.8.6j. For
purposes of our ease let's rename it to just cacti with the foll command:

sudo mv cacti-0.8.6j cacti

Now that the directory is renamed let's move it to our lampp
directory so that we can access it via our webserver. To do so run the
foll command:

sudo mv cacti /opt/lampp/htdocs

Now our Cacti directory is copied into lampp’s webroot directory.
Remember we had created a database in MySQL named cacti, now we need to
populate this database, which you should not worry about if you dont
understand, just follow the foll steps:

You will be greeted with a screen which will be the beginning of the installation, just click on next.

On the next screen you will asked if it's a new install, which of
course it is,confirm whether the database user and the database name
mentioned are correct, go back to step 7.3 and check, click on next.

7.5: When we click it shows us the base paths of all needed files.
We will notice that the path for php is marked in red because the path
is wrong. The path shown in the installer is:

/usr/bin/php

We have to change that to:

/opt/lampp/bin/php

and then click finish.

Cacti is now installed.

It will open up to the Cacti homepage and ask you for a username and password. Type in:

admin

and password as

admin

It will then force you to change the password, type in the new password that you decide on and log in using the new password.

We need to do a bit more stuff, you see Cacti works by polling the
devices which we set it up for, so let's set the poller for every 5
minutes. Open up terminal and type in the foll command:

Then press ctrl x and come out. Now all along we have assumed the
username to log in to your machine is deadwait, hence the deadwait is added
above, now we need to do one last thing. Type in the following command
in a terminal:

With version 5.5.8 of MySQL, the import might throw in an error because cacti.sql uses TYPE=MyISAM and should be using ENGINE=MyISAM. I've opened up the file in an editor and did a find and replace and then MySQL imported the file.