Spine轮询插件
在设备比较多的情况下使用spine替代原有的轮询程序。可以加速轮询的时间,及图像生成时间。
1.安装spine
[root@game-inc ~]# tar zxvf cacti-spine-0.8.8a.tar.gz
[root@game-inc ~]# cd cacti-spine-0.8.8a
[root@game-inc cacti-spine-0.8.8a]# ./configure --prefix=/usr/local/cacti-spine
[root@game-inc cacti-spine-0.8.8a]# make && make install
[root@game-inc cacti-spine-0.8.8a]# cd /usr/local/cacti-spine/etc/
[root@game-inc etc]# cp spine.conf.dist spine.conf
[root@game-inc etc]# vi spine.conf
DB_Host cacti
DB_Database cacti
DB_User cacti
DB_Pass p@ssw0rd
DB_Port 3306
DB_PreG 0
这里修改对应的mysql用户名和密码,以及连接参数
打开“console”----“settings”----“Paths” 中填写spine的路径,然后“save”
[root@localhost opt]# /usr/local/cacti-spine/bin/spine
2.选择轮询模式
打开“console”----“settings”----“Poller”---“save”
添加“每分钟”流量视图
打开“console”---“Data Templates”——“Interface - Traffic”
最后修改crontab
[root@game-inc ~]# crontab –e
* * * * * env LANG=C /usr/bin/php /var/www/html/cacti/poller.php>/dev/null 2>&1
验证一下
先修改/etc/php.ini,否则执行轮询时会报错:
找到date.timezone,去掉前面的注释并
改为
date.timezone = PRC
或
date.timezone = Asia/Shanghai
[root@game-inc cacti]# cd /var/www/html/cacti/
[root@game-inc cacti]# php poller.php
12/21/2012 02:11:39 AM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval! The Poller Interval is '60' seconds, with a maximum of a '300 ' second Cron, but 218 seconds have passed since the last poll!
OK u:0.00 s:0.00 r:0.11
OK u:0.00 s:0.00 r:0.11
OK u:0.00 s:0.00 r:0.11
OK u:0.00 s:0.00 r:0.11
OK u:0.00 s:0.00 r:0.11
OK u:0.00 s:0.00 r:0.11
12/21/2012 02:11:39 AM - SYSTEM STATS: Time:0.2211 Method:spine Processes:1 Thre ads:1 Hosts:2 HostsPerProcess:2 DataSources:7 RRDsProcessed:6