[cacti监控] centos6.2下安装cacti监控
1> 配置LAMP环境
a> 安装mysql数据库
yum -y install mysql mysql-server mysql-devel
b> 配置apache与php
yum -y install httpd php php-mysql
www.zhishiwu.com
2> 安装rrdtool和net-snmp
yum -y install zlib freetype libjpeg fontconfig gd libxml2 php-gd
yum -y install perl-Net-Daemon perl-PlRPC perl-DBI rrdtool perl-rrdtool perl-DBD-MySQL
yum -y install php-pdo lm_sensors net-snmp php-snmp net-snmp-utils
3> 安装cacti
tar -zxvf cacti-0.8.8a.tar.gz
mv cacti-0.8.8a /var/www/html/cacti/
4> 配置cacti
a> 配置httpd服务
vim /etc/httpd/conf.d/cacti.conf
[plain]
Alias /cacti /var/www/html/cacti
DirectoryIndex index.php
AllowOverride all
order deny,allow
deny from all
allow from all
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc on
php_flag track_vars on
vim /etc/httpd/conf/httpd.conf
[plain]
276 ServerName localhost:80
vim /etc/php.ini
[plain]
946 date.timezone = PRC
service httpd start
b> 配置 mysql并导入 cacti.sql
service mysqld start
mysqladmin -u root password '123456'
mysql -uroot -p123456
mysql> create database cacti;
mysql> grant all on cacti.* to cacti@'localhost' identified by '123456';
mysql> flush privileges;
mysql -u cacti -p123456 cacti < /var/www/html/cacti/cacti.sql
c> 配置snmpd服务
vim /etc/snmp/snmpd.conf
[plain]
41 com2sec notConfigUser 127.0.0.1 public
62 access notConfigGroup "" any noauth exact all none none
85 view all included .1 80
service snmpd start
d> 配置cacti目录权限
useradd cacti -d /var/www/html/cacti -s /bin/false
chown -R root:root /var/www/html/cacti/
chown -R cacti:cacti /var/www/html/cacti/rra /var/www/html/cacti/log
e> 配置cacti连接数据库
vim /var/www/html/cacti/include/config.php
[plain]
29 $database_username = "cacti";
30 $database_password = "123456";
f> 配置cron计划任务
crontab -u cacti -e
[plain]
*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php &>/dev/null
5> 配置完成,设置服务开机自启动
chkconfig httpd on
chkconfig mysqld on
chkconfig snmpd on