先理清下思路因为本实验截图太多,以及并不是很顺利,其实呢个人觉得出问题还好啦,因为出了问题在实验时就解决了并收获经验,当真正在生产环境出问题才悲剧!
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
[root@radius src]# yum install net-snmp-devel mysql-devel openssl-devel dos2unix autoconf automake binutils libtool gcc cpp glibc-headers kernel-headers glibc-devel
[root@radius src]# tar -zxvf cacti-spine-0.8.8a.tar.gz
[root@radius src]# cd cacti-spine-0.8.8a
[root@radius 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
解决:
[root@radius cacti-spine-0.8.8a]# yum install net-snmp-devel
再次安装
[root@radius cacti-spine-0.8.8a]# ./configure --prefix=/usr/local/cacti-spine
[root@radius cacti-spine-0.8.8a]# make && make install
默认配置文件模版在
/usr/local/cacti-spine/etc/spine.conf.dist
我们需要把配置文件复制到/etc/spine.conf
[root@radius cacti-spine-0.8.8a]# cp spine.conf.dist /etc/spine.conf
原因看
[root@radius cacti-spine-0.8.8a]# vim spine.h
修改配置文件
[root@radius cacti-spine-0.8.8a]# vim /etc/spine.conf
测试是否安装成功
[root@radius cacti-spine-0.8.8a]# /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
解决:
[root@radius cacti-spine-0.8.8a]# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
再次测试
[root@radius cacti-spine-0.8.8a]# /usr/local/cacti-spine/bin/spine
报错
SPINE: Using spine config file [/etc/spine.conf]
04/26/2013 10:53:14 AM - SPINE: Poller[0] FATAL: Connection Failed, Error:'1045', Message:'Access denied for user 'cactiuser'@'localhost' (using password: YES)' (Spine init)
原因是应为cactiuser没有权限访问cacti数据库,我修改了下cactiuser用户的密码就OK了
再次测试成功了出现如下图
再次测试
[root@radius cacti-spine-0.8.8a]# /usr/local/cacti-spine/bin/spine
报错
SPINE: Using spine config file [/etc/spine.conf]
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[0] FATAL: Connection Failed, Error:'2002', Message:'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' (Spine init)
解决
[root@radius bin]# vim /etc/spine.conf
把DB_Host 修改成127.0.0.1就ok
到此安装spine完成,接下来就是如何修改成每分钟查询一次数据了
添加一个新的RRAs以便于我们观察的到每分钟的变化,默认的绘图行数太多看不出变化
编辑一下数据模版加入我们刚才建立的RRA's
修改一下setp为60秒,默认是300
然后保存
设置spine路径
我们来设置轮询时间
接下来我们添加一个监视本地主机登录用户的绘图
删除所有的绘图文件
添加一个新的主机
删除不必要的
点击
勾选点击创建,颜色默认
把主机添加到默认树里面去
进入绘图监视界面查看效果
观察每分钟都会有新绘图产生,也可以自己多建立几个ssh登录看效果,1分钟就可以查询到数据,并且画好图!