Your IP...


Saturday, July 23, 2011

Cacti-0.8.7g installation on Fedora 15 x64

Cacti installation on Fedora 15 x64

1. Install required packages for cacti.


yum -y install httpd php mysql mysql-server php-mysql rrdtool net-snmp* cacti


2. After install packages start mysqld andset up password for your mysqladmin. Here I have mentioned that as admin123

/etc/init.d/mysqld start

Add mysql service to start up

chkconfig mysqld on

mysqladmin -u root password


Start httpd too.......
/etc/init.d/httpd start
chkconfig httpd on


3. Login to mysql
mysql -u root -p

4. Create database for cacti
create database cacti;
grant all on cacti.* to root;
grant all on cacti.* to root@localhost;
grant all on cacti.* to cacti;
grant all on cacti.* to cacti@loc
alhost;
set password for
cacti@localhost=password('cacti123');
quit;

5. Open /etc/cacti/db.php set as followings,
$database_type = "mysql";

$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti123";
$database_port = "3306";


6. Now go to /usr/share/doc/cacti-0.8.7g
You can see cacti.sql database available


when you try to upload this cacti.sql to cacti database it will submit following error,

ERROR 1064 (42000) at line 5: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 6


Fedora 15 mysql default database engine work as InnoDB instead of MyISAM.

So using vim / vi you need to edit cacti.sql and replace 'TYPE' with 'ENGINE'
Use sed command to do this for you............ and save
your time...



sed -i -e 's/TYPE=/ENGINE=/g' /usr/share/doc/cacti-0.8.7g/cacti.sql



Thanks to fabian-affolter.ch for sed magic.............. :)


Now upload cacti.sql to your cacti database


mysql -u root -p cacti < cacti.sql



7. Go to /etc/httpd/conf.d and edit cacti.conf and allow for access


Alias /cacti /usr/share/cacti

Order Deny,Allow
Allow from all



You can check the syntaxt after edit file using
httpd -t

Syntax OK


8. Text based part is over :) and can start with graphical i
nstallation.
Go you your browser and type http://xxx.xxx.xxx.xxx/cacti










Click NEXT








Click NEXT












Verify all the necessary packages show properly with out error. Then click FINISH










It will prompt you login screen and put default user name and password as
admin
Click on LOGIN










This will force you to change the password. Change it to own password and click SAVE






Now you can see your cacti installation. You can move on with adding cacti graphs.....

Add following cronjob to collect data for cacti

crontab -e

*/5 * * * * root /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1


This poller.php will run every 5 min and collect data for cacti.

2 comments:

Eranga Perera said...

great work,,

for some linux distributions (in my case centOS 6) "yum install cacti" won't work.

In that case use http://apt.sw.be/redhat/el$releasever/en/$basearch/dag for a yum repo and check (worked for me)

Cha2ranga said...

Thanks mate..
Yes DAG repo support many linux distributions.
http://dag.wieers.com/rpm/

More about linux