Cacti数据采集周期修改为一分钟一次的方法

Cacti数据采集周期修改为一分钟一次的方法

Cacti 默认的数据采集周期是5分钟一次

首先,先登录 Cacti,进入 console > Settings > Poller 界面,将 Poller Interval  Cron Interval 均改为 "Every Minute" 选项,然后点击 Save 按钮保存。

然后,进入 Linux,修改 crontab 中的数据采集脚本运行周期为*/1 * * * *,例如:

*/1 * * * * /usr/local/php/bin/php /cacti/poller.php > /dev/null 2>&1

或者:

[root@cacti log]# cat /etc/crontab

SHELL=/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin

MAILTO=root

HOME=/

# For details see man 4 crontabs

# Example of job definition:

# .---------------- minute (0 - 59)

# | .------------- hour (0 - 23)

# | | .---------- day of month (1 - 31)

# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...

# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat

# | | | | |

# * * * * * user-name command to be executed

*/1 * * * * root /usr/bin/php /var/www/html/poller.php

*/1 * * * * root /usr/sbin/ntpdate 172.26.1.15 && /sbin/hwclock -w

0 1 * * 1 root /var/www/backup.sh

You have mail in /var/spool/mail/root

[root@cacti log]#

 

最后,回到 Cacti,进入 console > Data Templates 界面,修改所用到的数据模板,将Step 设为60,这里的单位是秒。(比较重要,如果没有修改,可能无法出图)

 

完成上述三个步骤后,还需要我们手工清理历史数据后 Cacti 才能正常采集数据和显示图表。

进入 console > System Utilities 界面,点击 "Rebuild Poller Cache"

 

至此我们已经成功将 Cacti 的数据采集周期由5分钟一次修改为1分钟一次了。

如果不能正常显图表,可尝试手工清除 cacti/rra 目录下的 rrd 文件。

posted on 2016-01-14 16:04  Michael_DD  阅读(2167)  评论(0)    收藏  举报

导航