Cacti with Xampp on Ubuntu

Cacti Setup Guide:

This is a simple setup of Cacti, so that you don’t really need a “linux” expert to maintain it. please note 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 setup here in mumbai.

what is Cacti? You can check out that here http://cacti.net

What is cacti being used for?

Cacti was primarily setup 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 pattern’s, get alerts etc.

So now we go on to the basic setup,

Requirement:

One linux machine – ( can be any depending on your choice try and keep atleast 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 a intranet web ftp server )

the cacti package – we will need to download this from http://cacti.net

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 doc’s on the net.

Ubuntu installation :-

1: The First step now would be to install Linux on our machine, for this example we will download ubuntu ios from the following site http://cdimage.ubuntu.com/releases/gutsy/tribe-5/gutsy-desktop-i386.iso this is the current latest version of ubuntu.

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 on to 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 is running in live cd mode, i.e the hard disk is not being used, you will find a Install icon on the top left of your screen, double click on it and go ahead with the install, the only problem you might have is during partitioning as we are going in for a separate machine its best that we go in for auto partitioning ( a detailed ubuntu install guide is not really possible right now but it can 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 you network card will have to configured, i hope you remember the root password you had supplied during the installation.

4.1 : click on

    system --> administration --> network

and in the wired connection tab supply your needed ip address/ subnet mask and gateway

4.2 :if your internet access is through a proxy then click on

   system --> preferences --> network proxy

and supply your proxy server’s ip address and port.

4.3 : open up a terminal window ( Applications –> accessories –> terminal ) and type in the foll. commands

     sudo aptitude update

and then

     sudo aptitude install build-essential

4.4 : Once the build essential is over you are set to install Xampp , RRDtool and Cacti

5: We will begin with Xampp – to know in detail what xampp is check out their website http://www.apachefriends.org/en/xampp.html , Now we need to download Xampp for linux directly clicking on this link http://jaist.dl.sourceforge.net/sourceforge/xampp/xampp-linux-1.6.3b.tar.gz . This is the current latest version of Xampp. remember to download it to /opt . ( the reason im going in for /opt is because the same is mentioned in the website, but remember you can have it downloaded and installed anywhere .)

5.1: Now assuming you have downloaded the file in /opt you need to do the foll next. ( im 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

   Application --> 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 int 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 upto 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 tulip then my home folder becomes /tulip, the command to move the file is as follows

   sudo mv xampp-linux-1.6.3b.tar.gz /tulip

Now for the cool part –> int 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 lets 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 an 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 ( ofcourse 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. your going to love this, in a terminal box type in the magic commands

  sudo aptitude install rrdtool

and thats it rrdtool is installed ( Now for a bit of history, we can install entire cacti along with webserver php and mysql by doing sudo aptitude install cacti, but we havent 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 lets install one more tool needed which 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.

7: Now the cream – cacti installation.

first we need to download the cacti package which we can do so from this link http://www.cacti.net/downloads/cacti-0.8.6j.tar.gz

save the link on your eg: Desktop then open up a terminal and navigate to your deskto, the commands are (assuming your user login is tulip)

  cd /home/deadwait/Desktop

remember linux is case-sensitive so desktop wont 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 lets rename it to just cacti with the foll command

  sudo mv cacti-0.8.6j cacti

now that the directory is renamed lets move it in 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 on to lampp’s webroot directory, remember we had created a database in mysql named cacti, now we need to populate tis database, which you should not worry about if you dont understand, just follow the foll steps

7.2 :open up firefox and again go to phpmyadmin, http://localhost/phpmyadmin

on the left pane select the database which we have created, in our case its cacti.

then on the right pane select import –> then click on browse –> navigate to the directory /opt/lampp/htdocs/cacti in which you have to select the file cacti.sql and then click on go.

7.3: Again in a terminal type in

cd /opt/lampp/htdocs/cacti/include

then type in

sudo nano config.php

nano is an editor which will open up the file config.php, in the beginning you will see these options

 $database_type = "mysql";
 $database_default = "cacti";
 $database_hostname = "localhost";
 $database_username = "cactiuser";
 $database_password = "cactiuser";
 $database_port = "3306";

you need to change the username and password so that it looks like this

  $database_type = "mysql";
 $database_default = "cacti";
 $database_hostname = "localhost";
 $database_username = "root";
 $database_password = "";
 $database_port = "3306";

then press ctrl-x and come out.

7.4: Now open up firefox and type int the address bar the following http://localhost/cacti

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 its 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 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 lets set the poller for every 5 minutes, open up terminal and type in the foll command

 sudo nano /etc/crontab

this will open up the crontab file, now at the end type in the foll.

  • /5 * * * * deadwait /opt/lampp/bin/php /opt/lampp/htdocs/cacti/poller.php > /dev/null 2>&1

then press ctrl x and come out now all along we have assumed the username to login to your machine is tulip, hence the tulip is added above, now we need to do one last thing type in the following command in a terminal

 sudo chown -R 777 /opt/lampp/htdocs/cacti

thats its you are done!!! phew!

Advertisements

12 Responses to “Cacti with Xampp on Ubuntu”

  1. You skipped the whole part about creating the database in MySQL, and these do not work on server, desktop only.

  2. These do not work on Ubuntu server, and also you skipped the whole part about creating the cacti mysql user and giving that user full rights tot he cacti db. (you are using root with no password on a mysql server, not recommended at all) I see you have it on your site, how-to-forge and cacti.net, but you may want to correct this part, and also a few typos (tis instead of this) otherwise very good doc.

  3. Hi,

    I have followed this document exactly. When I go to “http:\\localhost\cacti” I get a blank page. Why????

    I would appreciate any help…

  4. Hi James,

    What do you get when you just type http://localhost
    and which operating system are you using ?

  5. How do I add a Cisco 3620 device. If some has step by step instructions I would really appreciate. If you are going to recomend to look @ another site, please don’t bother, I am having a difficult time already.

  6. haha, james, i wont recommend you to another site, i had a tough time myself doing this anyways so i know your pain,
    if you have got your cacti running up then first thing you should check if you have enabled your snmp server community on the 3620 , then you click on console on the admin web page then on devices on the left pane and then click add and fill in the details, it will then tell you which all options to fill, fill in the ip address and your community , you can leave the device as generic snmp and thats it add , once it detects the device click on create graphs for this host.

    on another note , have you tried the cacti forums?

  7. Hi,

    I followed ur installation guide for installing cacti. I’ve installed cacti and it works fine but my problem is that I can’t generate any graph. I even try it on localhost still there is no graphs generated. I would really appreciate it if you can help me with this one.

    Thanks,

    Regie

  8. hi have a similar problem to james i am getting a blank page on http://localhost/cacti/
    but when i type http://localhost i get teh fc 9 test page

    i am useing fc9 and i installed cacti by yum

    pls help

    regards

  9. hi have a similar problem to james i am getting a blank page on http://localhost/cacti/
    but when i type http://localhost i get teh fc 9 test page

    i am useing fc9 and i installed cacti by yum

    pls help

    regards

  10. i m also getting the same problem but i have installed cacti sucessfully on ubuntu-8.04.but while creating the graph for (my devices), im getting following error
    RRDTool Says:

    ERROR: parameter ‘#00CF00FF’ does not represent a number in line AREA:#00CF00FF:Inbound
    >>> so how to fix it? plz help me soon

  11. redmenn f Says:

    Hmmf the infamous blank page that no one has got an answer for. Even after following various instructions are install the architecture, the blank page appears. I feel sorry for any newbie messing with linux, 2 years down the line like I am now, I really hate linux.

  12. Dedicated Sunucu…

    […]Cacti with Xampp on Ubuntu « Deadwait’s grave[…]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: