由於cmd.php不能滿足項目需求,用spine替換掉
1.下載Cacti-spine最新版本,(要同使用的cacti版本相匹配)
下載地址:http://www.cacti.net/downloads/spine/
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源包
下載地址:http://sourceforge.net/projects/net-snmp/files/net-snmp/5.4.3/
[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/
[[email protected]]#/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf
[[email protected]]#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
[[email protected]]#./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,如下圖設置
這樣就結束了.
URL:http://www.bianceng.cn/OS/Linux/201410/46046.htm
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
下載最新補丁:
http://www.cacti.net/downloads/spine/patches/0.8.7g/unified_issues.patch
下載好的補丁放在cacti-spine-0.8.7g目錄下面
然後需重新執行安裝步驟
[[email protected]]#./configure --prefix=/usr/local/cacti-spine --with-snmp=/usr/local/net-snmp
[[email protected]]# 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]URL:http://www.bianceng.cn/OS/Linux/201410/46046.htm
解決方法:
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
問題圖如下: