Tuesday, December 27, 2011

Cacti graph Configuration

[root@localhost ~]# yum install httpd* -y
[root@localhost ~]# yum install php* -y
[root@localhost ~]# yum install net-snmp* -y
[root@localhost ~]# yum install mysql* -y
[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# chkconfig snmpd on
[root@localhost ~]# chkconfig mysqld on
[root@localhost ~]# cd Desktop/
[root@localhost Desktop]# ls
cacti-0.8.7g.tar.gz  cacti.zip  rrdtool-1.2.23-0.rhel5.i386.rpm
[root@localhost Desktop]# rpm -ivh rrdtool-1.2.23-0.rhel5.i386.rpm
[root@localhost Desktop]# /etc/rc.d/init.d/mysqld start
create user in mysql database server:
command:
#######
[root@localhost Desktop]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.07 sec)
mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cacti              |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti';
Query OK, 0 rows affected (0.07 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye


[root@localhost Desktop]# tar -zxvf cacti-0.8.7g.tar.gz
[root@localhost Desktop]# ls
cacti-0.8.7g  cacti-0.8.7g.tar.gz  cacti.zip  rrdtool-1.2.23-0.rhel5.i386.rpm
[root@localhost Desktop]# cp -fr cacti-0.8.7g /var/www/html/
[root@localhost Desktop]# cd /var/www/html/
[root@localhost html]# ls
cacti-0.8.7g
[root@localhost html]# mv cacti-0.8.7g cacti
[root@localhost html]# useradd cacti
[root@localhost html]# cd cacti/
[root@localhost cacti]# cd include
[root@localhost include]# vim config.php
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
[root@localhost cacti]# cd /var/www/html/cacti/
[root@localhost cacti]# chown -R cacti rra/ log/
[root@localhost cacti]# mysql cacti < cacti.sql
[root@localhost cacti]# echo "" >/etc/snmp/snmpd.conf
[root@localhost cacti]# vim /etc/snmp/snmpd.conf
rocommunity public
[root@localhost cacti]# /etc/init.d/mysqld restart
Stopping MySQL:                                            [  OK  ]
Starting MySQL:                                              [  OK  ]
[root@localhost cacti]# /etc/init.d/httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd:                                                [  OK  ]

if face any problem, edit the following files:

vi /etc/hosts
127.0.0.1    localhost
vi /etc/http/conf/httpd.conf

serverAdmin localhost
[root@localhost cacti]# crontab -e
*/2 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1 
[root@localhost cacti]# /etc/init.d/crond restart
Stopping crond:                                            [  OK  ]
Starting crond:                                               [  OK  ]