spine是一个基于C语言的,非常快速的轮询引擎。它是默认的cmd.php的可选替代,主要是为了加快SNMP轮训。如果你的cmd.php 运行超过300 秒的话,推荐使用Spine。本文主要讲解如何安装配置spine替代cmd.php。
debian cacti 0.8.8b
Cacti Spine 源码包下载地址
安装依赖包:
yum install -y net-snmp-devel openssl-devel mysql-devel
wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8b.tar.gz
解压编译
tar zxf cacti-spine-0.8.8b.tar.gz
./configure --with-mysql=/usr/local/mysql
make && make install
cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc
vi /etc/spine.conf
DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass *********
DB_Port 3306
DB_PreG 0
修改为你的Cacti数据库相关信息,然后执行如下命令
/usr/local/spine/bin/spine
SPINE: Using spine config file [/etc/spine.conf]
SPINE: Version 0.8.7i starting
SPINE: Time: 1.1416 s, Threads: 1, Hosts: 4
如果是其他输出如FATAL: Unable to read configuration file! (Spine init)
可能配置文件有错误
Cacti 配置
a)以admin用户登录到Cacti。
b)从目录菜单中选择设置”Settings”,选择”Paths”选项卡。
c)在”Spine Poller File Path”中输入Spine可执行程序的完整路径,我这/usr/local/spine/bin/spine
,保存设置。
d)选择”Poller”选项卡。
e)在”Poller Type”下拉框设置中,选择”spine”。
f)再到目录菜单中选择“System Utilities”,点击“Rebuild Poller Cache”。
Poller 优化建议
Maximum Threads per Process 设置为CPU个数即可
Poller Interval Every Mintue (最小可设置10s,不建议,感觉每分钟采集一次足够)
Cron Interval Every Mintue
查看下Cacti日志(建议安装clog插件):
01/17/2012 11:31:02 PM – SYSTEM STATS: Time:0.1105 Method:spine Processes:1 Threads:1 Hosts:4 HostsPerProcess:4 DataSources:51 RRDsProcessed:27
原:
01/17/2012 10:46:03 PM – SYSTEM STATS: Time:0.5050 Method:cmd.phpProcesses:1 Threads:N/A Hosts:4 HostsPerProcess:4 DataSources:51 RRDsProcessed:27
查看服务器的流量图是否正常。