安装需求:
1,web服务,httpd/nginx等等
2,MySQL
3,php,php-mysql
4,net-snmp
安装过程:
1,nginx,从官网yum安装,地址)
修改nginx.conf配置文件,配置php转发.
例如
location ~ \.php$ {
root /home/www/cacti/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
location ~* ^.+\.(css|js|ico|gif|jpg|jpeg|png|html|htm)$ {
root /home/www/cacti/;
index index.html index.htm;
}
nginx启动
./nginx
2,mysql
1,cmake
yum install gcc-c++ gcc
2,mysql 5.5
3,php(带ldap认证模块)
php5.3版本,内置了fpm功能模块
下载
wget
解压,编译
tar zxvf php-5.3.6.tar.gz
cd php-5.3.6
./configure --prefix=/usr/local/php --enable-sockets --enable-fpm --with-mysql=/home/q/mysql --with-ldap
make
make install
复制一个php.ini文件
cp ../php-5.3.6/php.ini-production /usr/local/php/lib/
添加时区的参数,设置cacti的时候会用到
date.timezone = "Asia/Chongqing"
修改/usr/local/php/etc/php-fpm.conf配置文件,将以下参数取消注释
pid = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = notice
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
启动php-fpm服务(端口9000)
/usr/local/php/sbin/php-fpm
验证php的功能,编写一个php的测试页面,内容如下
phpinfo();
?>
4,准备
安装rrdtool,这个工具是用来绘图的,先下载一个yum源
wget
yum install rrdtool
yum install net-snmp-devel net-snmp-utils openssl-devel
5,cacti-0.8.7h
wget
tar zxvf cacti-0.8.7h.tar.gz
mv cacti-0.8.7h/* /home/www/cacti/
6,cacti-plugin-0.8.7h-PA-v3.0
wget
cp -rf files-0.8.7h/* /home/www/cacti/
导入数据
mysql cacti < cacti.sql
mysql cacti < pa.sql
创建连接用户
GRANT ALL ON cacti.* TO 'cacti'@'127.0.0.1' IDENTIFIED BY 'XXX';
修改include/config.php文件,配置mysql连接
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "127.0.0.1";
$database_username = "cacti";
$database_password = "XXX";
$database_port = "3306";
$database_ssl = false;
7,cacti-spine-0.8.7h
wget
./configure --with-mysql=/home/mysql
修改连接MySQL的配置文件/usr/local/spine/etc/spine.conf
测试命令/usr/local/spine/bin/spine
8,设置定时任务定时,crontab
*/5 * * * * /usr/local/php/bin/php /home/www/cacti/poller.php > /dev/null 2>&1
9,打开浏览器,登录cacti的web界面
9.1设置spine,因为spine采集数据的效率要高于cmd.php
Setting----paths----“Spine Poller File Path”|选中”Structured RRA Path (/host_id/local_data_id.rrd)
阅读(1016) | 评论(0) | 转发(0) |