spine相对于cmd.php来说,效率更高,支持多线程,分布式从多个监控主机上收集数据
[root@node1 ~]# ls
cacti-0.8.8b.tar.gz
[root@node1 ~]# tar-zxvf cacti-spine-0.8.8b.tar.gz
[root@node1 ~]# cdcacti-spine-0.8.8b
[root@node1cacti-spine-0.8.8b]# ls
aclocal.m4 ChangeLog configure.ac INSTALL LICENSE.LGPL Makefile.in package ping.h README-WINDOWS spine.conf.dist util.c
AUTHORS common.h COPYING keywords.c locks.c NEWS php.c poller.c snmp.c spine.h util.h
autom4te.cache config error.c keywords.h locks.h nft_popen.c php.h poller.h snmp.h sql.c
bootstrap configure error.h LICENSE Makefile.am nft_popen.h ping.c README spine.c sql.h
首先安装依赖包:
[root@node1 etc]#yum install gcc make net-snmp-develmysql mysql-devel openssl-devel -y
[root@node1cacti-spine-0.8.8b]#./configure
[root@node1cacti-spine-0.8.8b]# make;make install
然后你可以发现spine默认安装到了/usr/local/spine里面
[root@node1 bin]# cd/usr/local/spine/
[root@node1 spine]#ls
bin etc
[root@node1 spine]#cd etc/
[root@node1 etc]# ls
spine.conf.dist
[root@node1 etc]# cpspine.conf.dist spine.conf
[root@node1 etc]# ls
spine.conf spine.conf.dist
[root@node1 etc]# vimspine.conf
DB_Host localhost
DB_Database cactidb
DB_User cactiuser
DB_Pass cacti
DB_Port 3306
DB_PreG 0
然后执行spine命令,成功的话就是配置好了
[root@node1 etc]#/usr/local/spine/bin/spine
SPINE: Using spineconfig file [spine.conf]
SPINE: Version 0.8.8bstarting
SPINE: Time: 1.0697s, Threads: 1, Hosts: 3
[root@node1 etc]# cd
[root@node1 ~]# /usr/local/spine/bin/spine #退出来以后你会发现执行那个命令失败,因为没有配置文件读取,所以会失败,linux默认读取文件是在/etc下,所以需要把这个配置文件移动到/etc/下面进行执行
02/23/2014 04:57:09AM - SPINE: Poller[0] FATAL: Unable to read configuration file! (Spine init)
[root@node1 ~]# cp/usr/local/spine/etc/spine.conf /etc/
[root@node1 ~]#/usr/local/spine/bin/spine
SPINE: Using spineconfig file [/etc/spine.conf]
SPINE: Version 0.8.8bstarting
SPINE: Time: 0.7473s, Threads: 1, Hosts: 3
然后进配置界面把poller的类型更换为spine
然后保存,在更改spinepoller文件的路径
然后计划任务更改为一分钟执行一次
[root@node1 ~]# vim/var/spool/cron/cactiuser
*/1 * * * */usr/bin/php /cacti/cacti/poller.php &>/dev/null
切换到cactiuser用户下执行poller.php
[cactiuser@node1 ~]$php /cacti/cacti/poller.php
然后就可以更改数据模板的step和hearbeat时间了