欢迎来到HugNew-拥抱变化,扫一扫右边二维码关注微信订阅号:Martin说 或 加QQ群:427697041互相交流,Stay hungry, Stay foolish.

Centos7 cacti 使用笔记

linux jim 2786℃ 0评论

Centos7 cacti 使用笔记

1. 请参考如下网址进行基本安装与配置

http://tecadmin.net/install-cacti-on-centos-rhel-systems/

You can do `yum install cacti –nogpgcheck` to install the packages

Then `yum install snmpd`

2. Add a readonly community to snmpd.conf.

Then you can use snmpget/snmpwalk to get interface statistics

Add a line below `com2sec ` line

rocommunity 123

3. Use snmpget/snmpwalk to try to get some info

snmpwalk -v2c -c123 localhost

4. visit http://YOURIP/cacti to see the result

If not accesable, please google the log error

The log is under /var/log/httpd/

5. After the configuration described on the website and you can visit cacti web console, you need to do several other things

1) set the timezone to Asia/Shanghai at several places. This is because cacti default use UTC which is not the same with your system’s timezone setting

2) Edit php’s timezone

/etc/php.ini:

timezone=Asia/Shanghai

3) set system’s timezone

systemctl list-timezones,
systemctl set-timezone Asia/Shanghai

4) set cacti’s timezone

In cmd.php, global.php, global_arrays.php etc, add following line

date_default_timezone_set('Asia/shanghai');

###############

6. Add a device and draw some statistics on “graph” tab

1) Management | devices | Add | fill it and save it | Add associated data query ->snmp iterface statitiscts | Ad

2) Create graph for this host | select the host, select which interface you want to draw | Create

3)management | data sources | select the data source you just created | Edit data template | Change the maximum value of traffic_in/traffic_out to 1000000000

4) management | graph tree | select default tree | Add | select host, select the newly created host | create

5) You should see the graph under graph tab now.

7.Debug cact web console

1) 查看rrd文件是否取到数据

rrdtool info /usr/share/cacti/rra/<your rra file> --->查看这个rra文件的创建参数, rrdtool create的参数
rrdtool fetch /usr/share/cacti/rra/<your rra file> AVERAGE/MAX --->这个命令就是查看是否能够画出图来的,如果能够读到数,就应该能画出图
rrdtool dump /usr/share/cacti/rra/<your rra file> ---->这个命令可以查看RRA里面的原始值,但是画图并不用这个原始值,要用CF函数聚合一下再画

2) 在web页面设置cacti的loglevel, 使能data source debugging, graph debugging

loglevel在configuration | settings | general | Poller specific logging | Poller Logging Level

data source debuging在 management | data sources | 随便点击一个data source进入datasource页面 | Turn on data source debug mode

graph debugging 在management | graph management | 随便点击一个graph进入graph页面 | Turn on graph debug mode

3) 设置Poller的log

在centos 7上更改/etc/cron.d/cacti如下:

将>dev/null 改成 > your_log_file即可

然后service crond restart

4) 查看各种Log

/var/log/cacti/cacti.log
/var/log/httpd/*.log
your_log_file set in /etc/cron.d/cacti

转载请注明:HugNew » Centos7 cacti 使用笔记

喜欢 (0)or分享 (0)
发表我的评论
取消评论

表情