Cacti The ULTIMATE Management Solution

Purpose

The purpose of this document is to explain how to install Red Hat’s Fedora Core 2 product and utilize a suite of applications for network based SNMP management. This document will take you thru step-by-step how-to install Linux on a new system and configure all the necessary tools that will get you a fully functional SNMP management station. SNMP management can be used to monitor just about anything on just about any IP enabled device.

Requirements

Before you get started make sure you have the following things:

. • Fedora Core 2 CD’s 1 thru 3

. • Active Connection to the Internet

. • Computer that can be formatted and have a new OS installed from scratch

. • About 3-4 hours of time

How it works

Cacti uses a suite of applications to do visual web front end graphing of results pulled via SNMP। These SNMP values can range from input/output rates on network / server interfaces to the number of mac-addresses associated to a given access-point. Using SNMP to manage a network can provide a non­technical central point of consolidation and health monitoring of your infrastructure. As stated earlier, SNMP is something that is already or can easily be enabled on many IP capable devices. Using SNMP to constantly pull statistical information and graphing that information can be useful in tracking things like disk utilization, network activity and much more. The CACTI application requires several utilities to be configured to work together in order to present the information in a GUI web front end. These utilities include a web server, a database, PHP and RDTOOL. All of which is freely available for the Linux operating system.

Show me the Files

You are now ready to begin downloading the files necessary to install and run Cacti. This can be done via the command line (CLI) using a command called wget. Before we start downloading the files we must first create a directory that we want to download the files to. For sake of this how-to that directory will be located under the root file system (/) in a directory called cacti-install. (Remember you should be logged in as root for the duration of this how-to. After all is setup you can login as a normal user and sudo for root privileged commands if you wish).

Run these commands as root

mkdir /cacti-install cd /cacti-install

wget http://apache.mirrors.versehost.com/httpd/httpd-2.0.52.tar.gz

wget http://us4.php.net/get/php-4.3.8.tar.gz/from/this/mirror

wget http://dev.mysql.com/get/Downloads/MySQL-4.0/mysql-4.0.21.tar.gz/from/http://www.signal42.com/mirrors/mysql/

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

wget http://unc.dl.sourceforge.net/sourceforge/net-snmp/net-snmp-5.1.2.tar.gz

wget http://www.cacti.net/downloads/cacti-0.8.6b.tar.gz

File Download Scrip


Once you have downloaded the files it is HIGHLY recommended to check the directory and make sure all the files are actually downloaded. As noted earlier version numbers change and the location of the files may change so the wget script will fail if that is the case. If they fail during download you must fine a new location

Install MySQL

Run these commands as root

cd /cacti-install

tar -zxvf mysql*

cd mysql*

./configure --prefix=/usr/local/mysql

make

make install

groupadd mysql

useradd -g mysql mysql

scripts/mysql_install_db

chown -R root /usr/local/mysql

chown -R mysql /usr/local/mysql/var

chgrp -R mysql /usr/local/mysql

rm -f /etc/my.cnf

cp support-files/my-medium.cnf /etc/my.cnf

echo /usr/local/mysql/lib/mysql >> /etc/ld.so.conf

echo /usr/local/lib >> /etc/ld.so.conf

ldconfig –v

cp support-files/mysql.server /etc/init.d/mysql /usr/local/mysql/bin/mysqld_safe --user=mysql & Echo

cd /etc/rc3.d/

ln -s ../init.d/mysql S85mysql

ln -s ../init.d/mysql K85mysql

cd /etc/rc5.d/

ln -s ../init.d/mysql S85mysql

ln -s ../init.d/mysql K85mysql

cd /etc/init.d/ chmod 755 mysql

MySQL Install Script



Install Apache

Run these commands as root


cd /cacti-install


tar -zxvf httpd*


cd httpd*


./configure --prefix=/www –enable-so


make


make install


cd /www/bin


cp apachectl /etc/init.d/httpd


y


cd /etc/rc3.d/


ln -s ../init.d/httpd S85httpd


ln -s ../init.d/httpd K85httpd


cd /etc/rc5.d/


ln -s ../init.d/httpd S85httpd


ln -s ../init.d/httpd K85httpd


/www/bin/apachectl start


Apache Install Script




Install PHP

Run these commands as root

cd /cacti-install

tar -zxvf php*

cd php*

./configure --prefix=/www/php --with-apxs2=/www/bin/apxs --with-config-file-path=/www/php --enable-sockets --with-mysql=/usr/local/mysql --with-zlib­dir=/usr/include –with-gd

make

make install

cp php.ini-dist /www/php/php.ini

cp /www/conf/httpd.conf /www/conf/httpd.conf.backup

echo ####################### >> /www/conf/httpd.conf

echo # Added via Lee Carter's Script >> /www/conf/httpd.conf

echo ####################### >> /www/conf/httpd.conf

echo AddType application/x-tar .tgz >> /www/conf/httpd.conf

echo AddType application/x-httpd-php .php >> /www/conf/httpd.conf

echo AddType image/x­icon .ico >> /www/conf/httpd.conf

echo DirectoryIndex index.php index.html index.html.var >> /www/conf/httpd.conf service httpd stop

service httpd start

PHP Install Script




Configure MySQL


Run these commands as root

cd /cacti-install

group-add cacti

useradd -g cacti cactiuser

/usr/local/mysql/bin/mysql

mysql> set password for root@localhost=password('rootpw');

mysql> create database cactidb;

mysql> grant all on cactidb.* to root;

mysql> grant all on cactidb.* to root@localhost;

mysql> grant all on cactidb.* to cactiuser;

mysql> grant all on cactidb.* to cactiuser@localhost;

mysql> set password for cactiuser@localhost=password('cactipw');

mysql> exit

MySQL Configure Script




Install RRDTOOL


Run these commands as root

cd /cacti-install

tar -zxvf rrdtool*

cd rrdtool* ./configure --prefix=/usr/local/rrdtool

make

make install

RRDTOOL Install Script




Install NET- SNMP


Run these commands as root

cd /cacti-install

tar -zxvf net-snmp*

cd net-snmp*

./configure

make

make install

NET-SNMP Install Script




Install Cacti



Run these commands as root

cd /cacti-install

cp cacti* /www/htdocs/

cd /www/htdocs/

tar -zxvf cacti*

mv cacti-0.8.6b cacti/

cd /cacti /usr/local/mysql/bin/mysql --user=root --password=rootpw cactidb <>

Cacti Install Script



Now edit your /www/htdocs/cacti/include/config.php

The finished product should look like so:

$database_defaut = “cactidb”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “cactipw”;

Now add the following line in your /etc/ctrontab The finished product should look like so:

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

NOTE*** DO NOT RUN THE ABOVE COMMAND. LET THE CRONTAB FILE RUN IT.

If you run the above command as root there will be several files created under ...../rra and ..../log that will now be owned by the user ROOT and your graphs will NOT populate correctly. So the moral is... JUST TYPE IN WHAT YOU SEE ABOVE AND SAVE THE FILES. DONT RUN THEM.


Finalize Setup

You are now ready to finalize the setup process for cacti. To do this you will need to point your browser to the IP address of the cacti system like so:

http://localhost/cacti

or

http://remoteIP/cacti

1. Click Next

2. Default (New Install) -> Click Next

3. Two errors locating php and rrdtool to Fix them replace what they have with:

RRDTOOL = /usr/local/rrdtool/bin/rrdtool

PHP = /www/php/bin/php

4. Click Finish

5. Login admin/admin

6. Change Password for user admin

7. Click Save


That'it! Your done. Congratulations on your new install. You can now start playing with the cacti utility it's self. I highly recommend going to the message boards to find add-ons and helpful hints when trying to do any advanced things in cacti. This is a highly versatile utility and is really only limited to your imagination.





0 $type={blogger}: