好吧,昨天有事情耽误了,结果拖了一天。
Cacti及插件安装
root@Only-test:/Ddisk/tool/tar/cacti> rpm -aq | grep snmp
好吧与研究的时候有点不一样。
root@Only-test:/Ddisk/tool/tar/cacti> yum list net-snmp*
root@Only-test:/Ddisk/tool/tar/cacti> yum install net-snmp*
这里主要是安装 net-snmp;net-snmp-devel;net-snmp-utils三个包。
其中net-snmp是服务包
net-snmp-utils包含了cacti要用的snmp执行程序,不装的话,进行cacti最初配置的时候会提示文件找不到。
root@Only-test:/> ln -s /Ddisk/program/apache/bin/* /usr/bin/
root@Only-test:/> ln -s /Ddisk/program/php/bin/* /usr/bin/
这两个忘记做链接了。恩等下Cacti里配置懒得打了
root@Only-test:/Ddisk/tool/tar/cacti> tar zxvf cacti-0.8.8c.tar.gz
root@Only-test:/Ddisk/tool/tar/cacti> mv cacti-0.8.8c /Ddisk/program/apache/htdocs/cacti
root@Only-test:/Ddisk/tool/tar/cacti> chown daemon.daemon -R /Ddisk/program/apache/htdocs/cacti
root@Only-test:/Ddisk/tool/tar/cacti> chown 755 -R /Ddisk/program/apache/htdocs/cacti
root@Only-test:/Ddisk/tool/tar/cacti> mysql
mysql> create database cacti;
mysql> use cacti;
mysql> source /Ddisk/program/apache/htdocs/cacti/cacti.sql;
mysql> grant all on cacti.* to cacti@'localhost' identified by 'cacti';
mysql> flush privileges;
mysql> exit;
root@Only-test:/Ddisk/program/apache/htdocs/cacti> vim include/config.php
修改如下:
其实就是cacti连接数据库的相关信息
root@Only-test:/Ddisk/program/apache/htdocs/cacti> chmod 777 rra
root@Only-test:/Ddisk/program/apache/htdocs/cacti> chmod 777 log
这两个,一个是放cacti采集到的数据信息,一个是日志,所以必须777
root@Only-test:/Ddisk/program/apache/htdocs/cacti> vim /Ddisk/program/php/lib/php.ini
root@Only-test:/Ddisk/program/apache/htdocs/cacti> /Ddisk/program/apache/bin/apachectl restart
*/5 * * * * /usr/bin/php /Ddisk/program/apache/htdocs/cacti/poller.php >> /tmp/cacti_rrdtool.log 2>&1
root@Only-test:/> service crond restart
OK,打开浏览器
直接下一步
选择全新安装
红框里的就是刚刚做的链接和net-snmp-utils rpm 包的安装结果。Finsh,完成
用户名和密码都是admin,第一次登录的时候会要求改密码
OK,这就是基础界面了。
点击上面的选项卡“graphs"然后选择Default Tree展开就可以看到Localhost的图了(不展开选择Localhost,默认是什么都没有)
如果看不图,那是因为五分钟还没到,系统没有取到数据生成图表,可以打下面的命令
root@Only-test:/> /usr/bin/php /Ddisk/program/apache/htdocs/cacti/poller.php --force
如果一切正常的话结果是:
/usr/bin/php /Ddisk/program/apache/htdocs/cacti/poller.php --force
可以生成限时数据,所谓早错早知道,是相当有用的排查命令之一
安装 monitor
root@Only-test:/Ddisk/tool/tar/cacti> tar zxf monitor-v1.3-1.tgz
root@Only-test:/Ddisk/tool/tar/cacti> mysql -ucacti -p cacti < monitor/monitor.sql
root@Only-test:/Ddisk/tool/tar/cacti> mv monitor /Ddisk/program/apache/htdocs/cacti/scripts/
root@Only-test:/Ddisk/tool/tar/cacti> chown daemon.daemon -R /Ddisk/program/apache/htdocs/cacti/plugins/monitor/
root@Only-test:/Ddisk/tool/tar/cacti> chmod 755 -R /Ddisk/program/apache/htdocs/cacti/plugins/monitor/
命令界面打完之后,选择“console"—>"Plugin Management"。可以看到Monitor插件已经就绪,点击橙框进行下载
之后,点击绿色键头开始启用插件
启用之后,最上方会出现"monltor“选项卡。下面再点击一下,插件就会停用。
点击"monltor“选项卡。则会出现一个比例友好的主机界面
安装spine
root@Only-test:/Ddisk/tool/tar/cacti> tar zxvf cacti-spine-0.8.8c.tar.gz
root@Only-test:/Ddisk/tool/tar/cacti> cd cacti-spine-0.8.8c/
root@Only-test:/Ddisk/tool/tar/cacti/cacti-spine-0.8.8c>./configure --prefix=/Ddisk/program/spine
root@Only-test:/Ddisk/tool/tar/cacti/cacti-spine-0.8.8c> make && make install
root@Only-test:/Ddisk/program/spine> cd /Ddisk/program/spine/etc/
root@Only-test:/Ddisk/program/spine/etc> vim spine.conf.dist
root@Only-test:/Ddisk/program/spine/etc> cp spine.conf.dist spine.conf
root@Only-test:/Ddisk/program/spine/etc> ln -s /Ddisk/program/spine/etc/spine.conf /etc
root@Only-test:/Ddisk/program/spine/etc> /Ddisk/program/spine/bin/spine
注:不把conf文件链接到/etc下,直接打spine是不会出现上面这个效果的,但cacti还是可以用。
转到cacti界面,选择选项卡"console"—>Settings—>Paths—>Spine poller File Path,填写spine执行文件的路径(安装路径的bin文件夹下)
然后。选择选项卡"console"—>Settings—>Poller可以把轮询器从cmd换成spine。具体配置,后面讲。
安装 settings
root@Only-test:/Ddisk/tool/tar/cacti> tar zxf settings-v0.71-1.tgz
root@Only-test:/Ddisk/tool/tar/cacti> mv settings /Ddisk/program/apache/htdocs/cacti/plugins/
Settings的安装其实和monltor差不多,选择“console"—>"Plugin Management"。点击橙色
点击绿色
完成
安装thold
root@Only-test:/Ddisk/tool/tar/cacti> tar zxf thold-v0.5.0.tgz
root@Only-test:/Ddisk/tool/tar/cacti> mv thold/ /Ddisk/program/apache/htdocs/cacti/plugins/
同样选择“console"—>"Plugin Management"。点击橙色
点击绿色
然后最上面会多出一个thold选项卡
安装realtime
root@Only-test:/Ddisk/tool/tar/cacti> tar zxf realtime-v0.5-1.tgz
root@Only-test:/Ddisk/tool/tar/cacti> mv realtime /Ddisk/program/apache/htdocs/cacti/plugins/
root@Only-test:/Ddisk/tool/tar/cacti> mkdir /Ddisk/program/apache/htdocs/cacti/cache
root@Only-test:/Ddisk/tool/tar/cacti> chmod 777 /Ddisk/program/apache/htdocs/cacti/cache/
同样选择“console"—>"Plugin Management"。点击橙色
点击绿色
这里要设置一下realtime生成的临时图片所在的缓存文件夹。
选择“console"—>Settins—>Misc在Cache Directory 填入缓存文件夹的路径。
打开graphs选项卡,随便找一张图表,发现右边多出了一个按键,点击一下
可以看到,数据信息最短可以查看5秒以内的。