Network,Server statistics graphing Using Cacti in Ubuntu Server

Cacti is a complete network graphing solution designed to harness the power of RRDTool’s data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for
LAN-sized installations up to complex networks with hundreds of devices.


Now we are going install Cacti from source code.If you are trying to install from source code you will have some
advantages like latest version you can install.

Preparing Your server for Cacti

Install Apache Web Server with PHP support in Ubuntu Server

sudo apt-get install apache2 apache2-common apache2-mpm-prefork apache2-utils

sudo apt-get install libapache2-mod-php4 php4-cli php4-common php4-cgi

If you want to install php5 support use the following command

sudo apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi

This will complete the apache2 webserver installation

Install Mysql Server with php Support

sudo apt-get install mysql-server mysql-client libmysqlclient12-dev

sudo apt-get install php4-mysql

If you want to install php5 support use the following command

sudo apt-get install php5-mysql

Other Dependencies Installation

sudo apt-get install make gcc g++

sudo apt-get install cgilib freetype2 libttf-dev libttf2 libpngwriter0-dev libpng3-dev libfreetype6-dev libart-2.0-dev snmp

Install RRD Tool From Source

Now you need to download latest rddtool

sudo cd /usr/local/src/

sudo wget http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/rrdtool-1.2.15.tar.gz

sudo tar xfvz rrdtool-1.2.15.tar.gz

sudo cd rrdtool-1.2.15

sudo ./configure

sudo make

sudo make install

This will complete the RRD tool Installation from Source

Installing Cacti From Source

Now you need to download Latest Version of Cacti From here http://www.cacti.net/download_cacti.php to your apache web server document root by default this is /var/www/ you can download if you changed your document root to some other path.

sudo cd /var/www/

sudo wget http://www.cacti.net/downloads/cacti-0.8.6i.tar.gz (At the time of writing)

Extract the distribution tarball.

sudo tar xzvf cacti-0.8.6i.tar.gz

Now you should have cacti-0.8.6i directory now you can move this to cacti directory

sudo mv cacti-0.8.6i cacti

Now you need to make sure that you have the correct permissions for inside cacti folders and files

sudo chown -R www-data:www-data rra/ log/

Import the default cacti database

sudo mysql cacti < cacti.sql Optional: Create a MySQL username and password for Cacti. sudo mysql --user=root mysql mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘somepassword’;

mysql> flush privileges;

mysql> exit
Bye

I am creating cactiusers as mysql database user with password as cacti.

Now you need to Edit /var/www/cacti/include/config.php and specify the MySQL user, password and database for your Cacti configuration.

$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “cacti”;

Enter a valid username for cactiuser, this user will also be used in the next step for data gathering.

Now we need to add the crontab for poller

sudo crontab -e

Add the following line ans save you can chnage the time whenever you want.

*/5 * * * * cactiuser php /var/www/cacti/poller.php > /dev/null 2>&1

Replace cactiuser with the valid user specified in the previous step.

Replace /var/www/cacti/ with your full Cacti path.

Point your web browser to http://your-server-ip/cacti/ this will start with the following screen here click next

Here you need to select the type of installation and click next

Now it will check all the required paths are correct or not you can see this in the following screen

in the above screen RRD Tool Binary Path is showing as NOT FOUND because we have installed from source you need to
enter this line /usr/local/rrdtool-1.2.15/bin/rrdtool it will work without any problem and click finish.

If you don’t want to install from souce and you can install from ubuntu package using the following command

sudo apt-get install rrdtool

If you install from package it will automatically detect the RRD Tool Binary path without problem.

Now you should see the Cacti Login screen as follows here you need to enter username and password as admin/admin and click login

first time it will prompt you to chnage cacti admin user password for security reasons and click save

You should see the following screen like below once you logged.

[thumb:595:c:l=p]

you need to make sure under configuration—>settings—>General RRDTool Utility Version option should be selected as RRD Tool 1.2.X Now your Cacti Monitoring Server is Ready and if you want to know how use cacti graphs and templates check here

You can monitor your Servers,Nework Devices and Many more with Cacti

If you want complete list of cacti templates check here

Sponsored Link

Leave a comment

Your email address will not be published. Required fields are marked *