cacti在gentoo上的安装步骤

Standard
cd /usr/portage/net-analyzer/rrdtool
emerge rrdtool-1.2.30.ebuild
 
emerge net-snmp
vi /etc/snmp/snmpd.conf
   com2sec local     127.0.0.1/32       public
   com2sec network   172.10.0.0/24       public
   group MyRWGroup v1         local
   group MyRWGroup v2c        local
   group MyRWGroup usm        local
   group MyROGroup v1         network
   group MyROGroup v2c        network
   group MyROGroup usm        network
   view all    included  .1                               80
   access MyROGroup ""      any       noauth    exact  all    all   none
   access MyRWGroup ""      any       noauth    exact  all    all    none
   syslocation MyLocation.
   syscontact Me 
 
emerge cacti  #安装过程中可能会因为在之前emerge php的时候USE没带上socket、xml、pcre而报错,加上它们重新emerge下php就行

cacti安装后默认路径在/usr/share/webapps/cacti/0.8.7b-r3/htdocs
因为我用nginx没装apache,没法用webapp-config命令来加cacti的虚拟主机,所以自己记着在nginx.conf里配一下.

配置cacti

cd /usr/share/webapps/cacti/0.8.7b-r3/htdocs
mysql -u root -p cacti < cacti.sql
vi include/config.php  #改mysql连接配置
crontab -e
*/1 * * * *       /usr/bin/php /usr/share/webapps/cacti/0.8.7b-r3/htdocs/poller.php > /dev/null 2>&1

安装cacti插件

cd /usr/share/webapps/cacti/0.8.7b-r3/htdocs
wget http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7e-PA-v2.5.zip
unzip cacti-plugin-0.8.7e-PA-v2.5.zip
patch -p1 -N --dry-run &lt; cacti-plugin-0.8.7e-PA-v2.5.diff #看下是否有报错,此步骤不会进行实际安装
patch -p1 -N &lt; cacti-plugin-0.8.7e-PA-v2.5.diff
mysql -u root -p cacti &lt; pa.sql
 
mkdir plugins
cd plugins
wget http://cactiusers.org/downloads/monitor.gzip
wget http://cactiusers.org/downloads/settings.gzip
wget http://cactiusers.org/downloads/thold.gzip
wget http://cactiusers.org/downloads/discovery.gzip

将上面下载的四个插件直接解开,记得把各插件里的*.sql文件导进数据库
所有插件的下载地址: http://cactiusers.org/downloads/ 注意要找版本号相同的

vi ../include/global.php  #在$plugins = array();一行后加上加上下面这些
$plugins[] = 'thold';
$plugins[] = 'monitor';
$plugins[] = 'settings';
$plugins[] = 'discovery';

问题来了,打完补丁后报error
Call to undefined function api_plugin_hook() in … /include/global_arrays.php on line 620
官网论坛里查了下发现不少人都有这问题
解决方法,查看*.rej文件,手工修改代码
到此安装完毕

Tips:
1.监控nginx mysql apache memcached的template和script可到下面这个网址下载:
http://code.google.com/p/mysql-cacti-templates/
2.要监控nginx记得把–with-http_stub_status_module加上,再配上location /status { … }
3.cacti的报警和实时性相对nagios和zabbix来说不算强项

转载请注明出处: http://yemaosheng.com

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.