由于cmd.php不能满足项目需求,用spine替换掉

1.下载Cacti-spine最新版本,(要同使用的cacti版本相匹配)

 
 
2.由于安装spine,测试中发现,执行—with-snmp= /usr/include/net-snmp/报“error: Cannot find UCD-SNMP libraries(snmp)”这个错误,最后只能卸载之前用yum安装的net-snmp
 
a.卸载net-snmp
[root@cacti soft]#yum list |grep net-snmp
[root@cacti soft]#yum remove net-snmp
 
b.安装net-snmp源包
[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
 
3.安装spine
[root@cacti soft]#wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.7g.tar.gz
[root@cacti soft]#tar zxvf cacti-spine-0.8.7g.tar.gz
[root@cacti soft]#cd cacti-spine-0.8.7g
[root@cacticacti-spine-0.8.7g]#./configure --prefix=/usr/local/cacti-spine --with-snmp=/usr/local/net-snmp
[root@cacti cacti-spine-0.8.7g]#make && make install
[root@cacti cacti-spine-0.8.7g]#cd /usr/local/cacti-spine/etc/
[root@cacti etc]#cp spine.conf.dist spine.conf
[root@cacti etc]#vi spine.conf
[root@cacti etc]#service httpd restarat
[root@cacti etc]#crontab -e(设置轮询刷新时间)

接着在cacti页面上面设置poller选择spine,如下图设置
 

这样就结束了.
 
 
4.由于这段时间发现cacti出问题,用snmkwalk能抓到数据,但图出不来,如下情况
 
 
后来查看了cacti日子信息后发现提示以下错误:
 

经过谷歌搜索,发现最近spine有bug,需要安装最新补丁.
 
+Patched 0.8.7g
+-bug#0001669: Problems with getting data from script using SPINE on Windows Server 2003 x32 
+-bug#0001829: Wrong string numerical value got from Spine SNMP poller 
+-bug: Net-snmp API issues cause spine crashes with some SNMP agents
+-bug: Host list not properly initialized
+-bug: Mutex locking issues cause deadlocks in Windows
+-bug: Escape windows type back slashes in scripts
 
下载最新补丁:
 
下载好的补丁放在cacti-spine-0.8.7g目录下面
然后需重新执行安装步骤
[root@cacticacti-spine-0.8.7g]#./configure --prefix=/usr/local/cacti-spine --with-snmp=/usr/local/net-snmp
[root@cacticacti-spine-0.8.7g]# patch -p1 -N < unified_issues.patch
[root@cacti cacti-spine-0.8.7g]#make && make install
[root@cacti cacti-spine-0.8.7g]#cd /usr/local/cacti-spine/etc/
[root@cacti etc]#cp spine.conf.dist spine.conf
[root@cacti etc]##vi spine.conf (覆盖后重新修改连接数据库的账号密码)

[root@cacti etc]#service httpd restarat
 
 重新查看cacti日志:

 再mark一下(2011.03.23)
 
报以下错误
03/23/2011 11:57:01 AM - PHPSVR: Poller[0] ERROR: Input Expected, Script Server Terminating
03/23/2011 11:57:01 AM - PHPSVR: Poller[0] ERROR: Input Expected, Script Server Terminating
03/23/2011 11:57:01 AM - PHPSVR: Poller[0] ERROR: Input Expected, Script Server Terminating
03/23/2011 11:57:01 AM - SPINE: Poller[0] FATAL: Connection Failed, Error:'1040', Message:'Too many connections' (Spine thread)

解决方法:

vim /etc/my.cnf

增加set-variable = max_connections=500

/etc/init.d/mysqld restart

 

再mark一下(2011.04.27)
 
最近发现cacti监控表每隔10分钟抓不到数据,很奇怪,也不知道哪位同事修改了Console -> Cacti Settings -poller-Poller Interval为30秒,后来改回一分钟一切恢复正常
 

因为在系统本身是设置一分钟,觉得有冲突
[root@cacti ~]# crontab -e
*/1 * * * * env LANG=C /usr/bin/php /var/www/html/poller.php > /dev/null 2>&1

问题图如下: