centos6.2下安装cacti监控
a> 安装mysql数据库
yum -y install mysql mysql-server mysql-devel
b> 配置apache与php
yum -y install httpd php php-mysql
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
- Alias /cacti /var/www/html/cacti
- <Directory /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
- </Directory>
vim /etc/httpd/conf/httpd.conf
- 276 ServerName localhost:80
vim /etc/php.ini
- 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
- 41 com2sec notConfigUser 127.0.0.1 public
- 62 access notConfigGroup "" any noauth exact all none none
- 85 view all included .1 80
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
- 29 $database_username = "cacti";
- 30 $database_password = "123456";
f> 配置cron计划任务
crontab -u cacti -e
- */5 * * * * /usr/bin/php /var/www/html/cacti/poller.php &>/dev/null
5> 配置完成,设置服务开机自启动
chkconfig httpd on
chkconfig mysqld on
chkconfig snmpd on
目录 返回
首页