王艳玲 发表于 2019-1-10 13:39:09

2、修改cacti轮询时间精度,以及添加监控主机

  先理清下思路因为本实验截图太多,以及并不是很顺利,其实呢个人觉得出问题还好啦,因为出了问题在实验时就解决了并收获经验,当真正在生产环境出问题才悲剧!
  1、安装spine
  2、编辑配置spine文件
  3、编辑RRAs(使看图更直观,因为cacti默认最小是5分钟一刻)
  4、配置spine路径
  5、修改使用spine轮询方式
  6、修改数据模版增加新增的RRAs
  7、创建新主机
  8、创建图到这个主机
  9、把主机加入到默认树里面去
  安装和配置spine支持快速轮询
  依赖包如下
  1. net-snmp-devel
  2. mysql-devel
  3. openssl-devel
  4. dos2unix
  5. autoconf
  6. automake
  7. binutils
  8. libtool
  9. gcc
  10. cpp
  11. glibc-headers
  12. kernel-headers
  13. glibc-devel
  # yum install net-snmp-devel mysql-devel openssl-devel dos2unix autoconf automake binutils libtool gcc cpp glibc-headers kernel-headers glibc-devel
  # tar -zxvf cacti-spine-0.8.8a.tar.gz
  # cd cacti-spine-0.8.8a
  # ./configure --prefix=/usr/local/cacti-spine
  报错:
  configure: error: Cannot find SNMP headers.Use --with-snmp= to specify non-default path
  解决:
  # yum install net-snmp-devel
  再次安装
  # ./configure --prefix=/usr/local/cacti-spine
  # make && make install
  默认配置文件模版在
  /usr/local/cacti-spine/etc/spine.conf.dist
  我们需要把配置文件复制到/etc/spine.conf
  # cp spine.conf.dist /etc/spine.conf
  原因看
  # vim spine.h
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427314KhnM.gif
  修改配置文件
  # vim /etc/spine.conf
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427315dXfh.gif
  测试是否安装成功
  # /usr/local/cacti-spine/bin/spine
  报错:
  /usr/local/cacti-spine/bin/spine: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
  解决:
  # ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
  再次测试
  # /usr/local/cacti-spine/bin/spine
  报错   
SPINE: Using spine config file    
04/26/2013 10:53:14 AM - SPINE: Poller FATAL: Connection Failed, Error:'1045', Message:'Access denied for user 'cactiuser'@'localhost' (using password: YES)' (Spine init)
  原因是应为cactiuser没有权限访问cacti数据库,我修改了下cactiuser用户的密码就OK了
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427315H4j5.gif
  再次测试成功了出现如下图
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427316p1SP.gif
  再次测试
  # /usr/local/cacti-spine/bin/spine
  报错
  SPINE: Using spine config file
  MYSQL: Connection Failed: Error:'2002', Message:'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
  MYSQL: Connection Failed: Error:'2002', Message:'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
  MYSQL: Connection Failed: Error:'2002', Message:'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
  MYSQL: Connection Failed: Error:'2002', Message:'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
  MYSQL: Connection Failed: Error:'2002', Message:'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
  05/02/2013 01:57:31 PM - SPINE: Poller FATAL: Connection Failed, Error:'2002', Message:'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' (Spine init)
  解决
  # vim /etc/spine.conf
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427320hpDz.jpg
  把DB_Host 修改成127.0.0.1就ok
  到此安装spine完成,接下来就是如何修改成每分钟查询一次数据了
  添加一个新的RRAs以便于我们观察的到每分钟的变化,默认的绘图行数太多看不出变化
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427324b8JP.gif
  编辑一下数据模版加入我们刚才建立的RRA's
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427328AtcE.gif
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427330P5n5.gif
  修改一下setp为60秒,默认是300
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427330dlg5.gif
  然后保存
  设置spine路径
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427340QHnP.gif
  我们来设置轮询时间
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427762SpAR.gif
  接下来我们添加一个监视本地主机登录用户的绘图
  删除所有的绘图文件
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427763EMoE.gif
  添加一个新的主机
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427772JhkO.gif
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427779XEez.gif
  删除不必要的
http://better.blog.运维网.com/attachment/201305/13/1886029_13684277819Pyv.gif
  点击
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427782GZN2.gif
  勾选点击创建,颜色默认
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427786ISYh.gif
  把主机添加到默认树里面去
http://better.blog.运维网.com/attachment/201305/13/1886029_13684277879ikL.gif
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427791y8Ph.gif
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427795R50B.gif
  进入绘图监视界面查看效果
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427796bjfo.gif
http://better.blog.运维网.com/attachment/201305/13/1886029_1368427797zNrX.gif
  观察每分钟都会有新绘图产生,也可以自己多建立几个ssh登录看效果,1分钟就可以查询到数据,并且画好图!



页: [1]
查看完整版本: 2、修改cacti轮询时间精度,以及添加监控主机