Cacti介绍
Cacti是用php语言实现的一个软件,它的主要功能是用snmp服务获取数据,然后用rrdtool储存和更新数据,当用户需要查看数据的时候用rrdtool生成图表呈现给用户。因此,snmp和rrdtool是cacti的关键。
Snmp关系着数据的收集,rrdtool关系着数据存储和图表的生成。snmp抓到数据不是存储在mysql中,而是存在rrdtool生成的rrd文件中(在cacti根目录的rra文件夹下,一般以rra为后缀名称)。
安装rrdtool采集工具
shell > yum install cairo-devel libxml2-devel pango pango-devel libart_lgpl libart_lgpl-deve
shell > tar xzf rrdtool-1.4.5.tar.gz
shell > cd rrdtool-1.4.5
shell > ./configure --prefix=/usr/local/rrdtool --disable-python --disable-tcl
shell > make && make install
shell > ln -s /usr/local/rrdtool/bin/* /usr/local/bin/
安装SNMP服务
shell > yum install net-snmp net-snmp-utils
shell > vim /etc/snmp/snmpd.conf
================================================================================
com2sec notConfigUser 127.0.0.1 public
access notConfigGroup "" any noauth exact all none none
view all included .1 80
================================================================================
shell > chkconfig snmpd on
shell > service snmpd start
安装cacti
shell > tar zxvf cacti-0.8.8c.tar.gz
shell > mv cacti-0.8.8c /usr/local/apache2/htdocs/cacti
创建cacti数据库并导入数据
mysql> CREATE DATABASE cacti DEFAULT CHARACTER SET utf8;
mysql> grant all on cacti.* to cacti@'localhost' identified by "123@qwe";
mysql> flush privileges;
shell > mysql -u cacti -p123@qwe cacti < /usr/local/apache2/htdocs/cacti/cacti.sql
shell > chmod -R 777 /usr/local/apache2/htdocs/cacti/rra
shell > chmod -R 777 /usr/local/apache2/htdocs/cacti/log
修改/usr/local/apache2/htdocs/cacti/include/config.php数据库配置
安装spine
spine是一个基于C语言的,非常快速的轮询引擎。它是默认的cmd.php的可选替代,主要是为了加快SNMP轮训。
shell > yum install net-snmp-devel mysql-devel
shell > tar zxvf cacti-spine-0.8.8c.tar.gz
shell > cd cacti-spine-0.8.8c
shell > ./configure --prefix=/usr/local/spine
shell > make && make install
shell > cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf
修改/usr/local/spine/etc/spine.conf数据库配置
添加Rrdtool抓图任务计划
shell > crontab -l
*/5 * * * * /usr/bin/php /usr/local/apache2/htdocs/cacti/poller.php > /dev/null 2>&1
shell > service crond restart
Cacti安装完毕,测试访问
- 访问http:///cacti --> next
- new install --> next
- 修改安装路径 --> finish
- 登录默认用户密码admin/admin, 修改保存密码
参考:
http://os.51cto.com/art/201411/458006_all.htm
https://blog.linuxeye.com/314.html
http://blog.chinaunix.net/uid-17015055-id-3071761.html
整理自网络
Svoid
2015-07-08
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29733787/viewspace-1735713/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29733787/viewspace-1735713/