CactiEZ安装tomcat监控模板2
继上一篇http://cwalet.iteye.com/blog/1141813
?
安装完成并配置好tomcat模板之后,图正确的生成出来了,但是却没有一点数据,NULL?
查看实时图形的时候又正确的出来了数据,进而重新使用perl tomcatstats.pl IP:PORT admin passwords http-8080查看有没有获取到tomcat manager status数据,结果是正确的。
怀疑是数据库没有保存实时获取的数据因而没有生成出图来。
?
以下过程参考:http://www.chenjunlu.com/2011/05/how-to-monitor-tomcat-server-by-using-cacti/
?
1.修改crontab任务:首先使用crontab -u [cactiuser] -l查看当前的poller任务:
*/5 * * * * php /var/www/html/poller.php > /dev/null 2>&1
默认是每隔5分钟重新生成一次图。然后使用crontab -u?[cactiuser] -e来编辑任务,设置为:
*/5 * * * * php /var/www/html/poller.php > /root/poller.log 2>&1
将poller日志重新导入到root下的poller文件中。
其中[cactiuser]表示你的安装cacti的用户,CactiEZ默认是root。
?
2.修改cacti的日志级别:依次进入:控制台—>(配置)设置—>(常规)采集器日志
修改采集器日志级别为开发-开发者调试级别(debug模式)。
?
过一段时间(5分钟左右),查看poller.log和cacti.log两个日志文件。
如果你在cacti.log文件中看到类似如下内容:
POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/apache/htdocs/cacti/rra/10_1_2_24_current_threads_bus_747.rrd template 1305860706:0ERROR: Not enough arguments
那就表示cacti及spine存在bug需要打补丁了。
cacti论坛上已经有相关的讨论:
http://forums.cacti.net/viewtopic.php?f=21&t=42742
官方的补丁下载及安装说明:
http://cacti.net/download_patches.php
http://cacti.net/spine_download_patches.php
?
以下过程参见:
http://viong.blog.51cto.com/844766/477235
http://www.6curl.com/post/8/
1.安装net-snmp:CactiEZ默认安装了net-snmp5.5.4,如果你的机器没有安装,那么到这里下载最新的5.7版:
http://sourceforge.net/projects/net-snmp/files/net-snmp/5.7/
或者将已安装的net-snmp移除后再安装新版:
viong 写道a.卸载net-snmp[root@cacti soft]#yum list |grep net-snmp
[root@cacti soft]#yum remove net-snmp
?安装过程如下:
viong 写道[root@cacti soft]#tar zxvf net-snmp-5.4.3.tar.gz[root@cacti soft]#cd net-snmp-5.4.3
[root@cacti net-snmp-5.4.3]#./configure --prefix=/usr/local/net-snmp
[root@cacti net-snmp-5.4.3]#make;make install
[root@cacti net-snmp-5.4.3]#cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf
[root@cacti net-snmp-5.4.3]#ln -s /usr/local/net-snmp/bin/* /usr/local/bin/
[root@cactinet-snmp-5.4.3]#/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf
[root@cactinet-snmp-5.4.3]#echo“/usr/local/net-snmp/sbin/snmpd /usr/local/net-snmp/share/snmp/snmpd.conf ”>>/etc/rc.local?
2.安装spine:重新编译安装spine并打补丁。从这里http://www.cacti.net/downloads/spine/下载所需的spine版本,注意:要先打上patch然后再编译,参见官方档:
After applying the patches, you must rebuild Spine using the 'make' command.下载:wget http://www.cacti.net/downloads/spine/patches/0.8.7g/unified_issues.patch
安装:patch -p1 -N < unified_issues.patch
在CactiEZ中没有patch命令,需要先安装:yum install patch
打完补丁后再编译安装:
./configure --prefix=/usr/local/spine --with-snmp=/usr/local/net-snmp
如果是CactiEZ,会在编译过程中提示没有找到mysql头文件:
configure: error: Cannot find MySQL headers. ?Use --with-mysql= to specify non-default path.
因为该系统默认是没有安装mysql头文件的,因此需要先安装:yum install mysql-devel
然后加上mysql头文件路径的参数后重新编译:
./configure --prefix=/usr/local/spine --with-snmp=/usr/local/net-snmp --with-mysql=/usr/include/mysql/
?
参考:http://xingxing5421.blog.163.com/blog/static/119446319201171831620237/
http://zhidao.baidu.com/question/219310192.html,http://bbs.chinaunix.net/thread-456632-1-1.html
?
注:如果是重新安装了net-snmp,请注意将其目录指向到/usr/local/spine以便cacti能自动找到bin/spine程序。
?
安装完成之后重启apache:/etc/init.d/httpd restart
过5分钟后即可看到已经正确的生成出了带数据的tomcat监控图。
?
附:如果安装完net-snmp5.7,poller.log的日志里可能会出现
Cannot find module (SNMPv2-SMI)......等等很多模块找不到的错误,这不会影响cacti的出图,已经有人讨论这个bug并且有了解决方案,参考net-snmp的邮件讨论组:
http://www.mail-archive.com/net-snmp-users@lists.sourceforge.net/msg28242.html
http://sourceforge.net/tracker/?func=detail&aid=3362233&group_id=12694&atid=312694
其它:http://blog.haohtml.com/archives/4913
?