Cacti是流行的流量监控软件。spine是一个基于C语言的,Spine非常精简,只用了大概500行CoffeeScript代码。轻量级和简介是Spine的基础。非常快速的轮询引擎。它是默认的cmd.php的可选替代,主要是为了加快SNMP轮询。如果你发现你的cmd.php 运行超过300 秒的话,推荐使用Spine。
异步结构――太多太多JavaScript应用和框架没能充分利用客户端渲染的作用。最终用户不关心后台请求服务器是否还在等待,更不想去看“正在加载”的消息和提示。用户渴望流畅的界面,流畅的互动。为了实现这个,Spine在浏览器端存储和渲染所有事物,并异步和服务器通信。
Spine本身相当简单的,她的库很小,API很极小
#/bin/sh
#Author:wangxu
#Date:2013-12-21
#Mail:[email protected]
#QQ:314144952
#version 1.2
# http://6622951.blog.51cto.com/
[ -f /etc/init.d/functions ] && . /etc/init.d/functions
if [ `id -u` -ne 0 ]; then
echo "Please re-run $0 asroot."
exit1
fi
[ ! -d /var/www/html/cacti ] && echo "cacti not found"&& exit 2
[ -f /etc/spine ] && echo "spine is found !" &&exit 2
yum -y install net-snmp-devel mysql-devel openssl-devel
###-------------------------installspine-----------------------
wgethttp://www.cacti.net/downloads/spine/cacti-spine-0.8.7g.tar.gz
tar zxvf cacti-spine-0.8.7g.tar.gz
cd cacti-spine-0.8.7g
wget http://www.cacti.net/downloads/spine/patches/0.8.7g/unified_issues.patch #补丁
./configure --with-mysql
[ $? -eq0 ] || exit 3 && make && make install
cp /usr/local/spine/etc/spine.conf.dist /etc/spine.conf
###-------------------------changeuser----------------------
CACTI_USER=`sed -n"/database_username/p" /var/www/html/cacti/include/config.php | awk-F '"' '{print $2}'`
SPINE_USER=`sed -n '/^DB_User/p' /etc/spine.conf| awk '{print $2}'`
[ "$SPINE_USER" != "$CACTI_USER" ] && sed-i -r "/^DB_User/s/$SPINE_USER/$CACTI_USER/g" /etc/spine.conf
###-------------------------changepasswd---------------------
CACTI_PASSWD=`sed -n"/database_password/p" /var/www/html/cacti/include/config.php | awk-F '"' '{print $2}'`
SPINE_PASSWD=`sed -n '/^DB_Pass/'p/etc/spine.conf | awk '{print $2}'`
echo $CACTI_PASSWD | grep '&' > /dev/null
if [ $? -eq 0 ]
then
CC_PASSWD=$(echo$CACTI_PASSWD | sed "s/\&/\\\&/g")
fi
[ "$SPINE_PASSWD" !="$CC_PASSWD" ] && sed-r -i "/^DB_Pass/ s/$SPINE_PASSWD/$CC_PASSWD/g" /etc/spine.conf
####-----------------------changedatabase----------------------
CACTI_DB=`sed -n "/database_default/p"/var/www/html/cacti/include/config.php | awk -F '"' '{print $2}'`
SPINE_DB=`sed -n '/^DB_Database/p'/etc/spine.conf | awk '{print $2}' `
[ "$SPINE_DB" != "$CACTI_DB"] && sed -i -r"/^DB_Database/ s/$SPINE_DB/$CACTI_DB/g" /etc/spine.conf
####-----------------------changeDB_Host-----------------------
CACTI_HOST=`sed -n"/database_hostname/p" /var/www/html/cacti/include/config.php | awk-F '"' '{print $2}'`
SPINE_HOST=`sed -n '/^DB_Host/p' /etc/spine.conf| awk '{print $2}' `
[ "$SPINE_HOST" != "$CACTI_HOST"] && sed -i -r "/^DB_Host/ s/$SPINE_HOST/$CACTI_HOST/g"/etc/spine.conf
###------------------------changeport---------------------------
CACTI_PORT=`sed -n "/database_port/p"/var/www/html/cacti/include/config.php | awk -F '"' '{print $2}'`
$SPINE_PORT=`sed -n '/^DB_Port/p'/etc/spine.conf | awk '{print $2}' `
[ "$SPINE_PORT" !="$CACTI_PORT" ] && sed-i -r "/^DB_PORT/ s/$SPINE_PORT/$CACTI_PORT/g" /etc/spine.conf
###--------------------------------------------------------------
ln -s /usr/local/spine/bin/spine /bin/spine
/usr/local/spine/bin/spine
[ $? -eq0 ] && action "spineinstall successed !" /bin/true ||\
action "spine install error! please check!" /bin/false
设置spine路径,Console――Settings――Paths
cacti设置spine路径
/usr/local/spine/bin/spine
更改cacti轮询器为spine,Console――Settings――Poller
cacti更改轮询器为spine
BUG及补丁信息
http://forums.cacti.net/post-63188.html