需要的包有:
rrdtool:http://blog.csdn.net/liv2005/article/details/7180438
nginx+php+mysql:http://blog.csdn.net/liv2005/article/details/7181508
首先,刚才nginx里mysql虽然装好了,但没配置
进入mysql的安装目录
cp support-files/my-medium.cnf /etc/my.cnf vi /etc/my.cnf #添加 skip-name-resolve max_connect_errors = 10000 connect_timeout = 15 interactive_timeout = 3600 wait_timeout = 3600 max_allowed_packet = 100M max_connections = 1500 max_heap_table_size=1G; tmp_table_size=1G; innodb_file_per_table #保存退出
#初始化数据库 /usr/local/mysql/bin/mysql_install_db --user=mysql #添加为服务: cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld chkconfig --add mysqld chkconfig --level 2345 mysqld on chown mysql:mysql -R /usr/local/mysql/
#启动mysql /etc/init.d/mysqld start #连接mysql /usr/local/mysql/bin/mysql #在mysql中,修改密码以及授权访问 grant all privileges on *.* to root@'localhost' identified by '密码'; grant all privileges on *.* to root@'127.0.0.1' identified by '密码'; create database cacti; grant all privileges on cacti.* to cactiuser@'localhost' identified by 'cactiuser'; use mysql; delete from user where password = ""; select host,user,password from user; exit
tar -zxvf net-snmp-5.7.1.tar.gz cd net-snmp-5.7.1 ./configure --prefix=/usr/local/net-snmp #对内容不敢兴趣的,可以一路回车 make make install cd .. tar -zxvf cacti-spine-0.8.7i.tar.gz cd cacti-spine-0.8.7i ./configure --with-snmp=/usr/local/net-snmp make make install cd .. cd /usr/local/spine/etc/ mv spine.conf.dist spine.conf
########### 下面开始安装Cacti,其实没啥特别的……用yum装cacti纯属自找麻烦.... #############
注意:Cacti 0.8.7i有两种发布包,一种常规的,另外一种自带Plugin Architecture (PIA),要用第二种,因为此后的cacti版本默认集成PIA,再也没有单独的PIA包可供升级使用了 tar -zxvf cacti-0.8.7i-PIA-3.1.tar.gz mv cacti-0.8.7i-PIA-3.1 /home/ossh/cacti cd /home/web chown web.web cacti/ -R chmod u+x cacti/ -R /usr/local/mysql/bin/mysql -u root -p'密码' cacti < /home/web/cacti/cacti.sql /home/fastcgi_nginx_ctl.sh start #基本模块安装成功,访问http://ip 使用页面进行install #如果不行的话,可能需要修改下nginx.conf里 root的目录地址
注意在Setting->Paths里,填写正确的路径
注意在Setting->Poller->Poller Type里选spine
#############扩展:安装Boost 一定程度上提高Cacti的性能,不然你会发现机器、图片多了,5分钟内都采集不完....#########
tar -zxvf boost-v5.1-1.tgz mv boost /home/web/cacti/plugins/ vi *.php //将#!头中的php路径修改为/usr/local/php/bin/php,同时修改cacti_rrdsvc和cacti_boost.conf中的相关路径 注意需要修改boost_server.php的这三行为: include_once("/home/web/cacti/include/global.php"); include_once("/home/web/cacti/lib/rrd.php"); include_once("/home/web/cacti/lib/poller.php"); #导入boost表结构 /usr/local/mysql/bin/mysql -u root -p'密码' cacti < /home/web/cacti/boost/boost_sql_memory.sql #启动boost /home/web/cacti/plugins/boost/cacti_rrdsvc start
废话:
Cacti的默认插件一般都不太够用,我个人喜欢用这套插件:
http://code.google.com/p/mysql-cacti-templates/