实战cacti配置
来源:互联网 发布:电信网络电视节目表 编辑:程序博客网 时间:2024/06/05 09:42
1.下载软件
wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz
wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8b.tar.gz
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.27.tar.gz (下载1.3版以上可能出现中文乱码问题)
2.安装软件
本机snmp相关服务
[root@test ~]# yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils
[root@test ~]# chkconfig –level 35 snmpd on
[root@test ~]# service snmpd start
[root@test ~]# vim /etc/snmp/snmpd.conf
将default修改为127.0.0.1,
com2sec notConfigUser 127.0.0.1 public
将其中62行的systemview改为all即可,并启用85行:
view all included .1 80
access notConfigGroup "" any noauth exact all none none
2、安装rrdtool
yum -y install libart_lgpl-develyum -y install pango-devel* cairo-devel*
cd ../rrdtool-1.2.27
./configure --prefix=/usr/local/rrdtool
make && make install
configure: error: Please fix the library issues listed above and try again错误
根据网上搜索,解决方法如下
- 第一:
- 安装 cgilib-0.5.tar.gz
- 从这里下载:
- weget http://download.chinaunix.net/down.php?id=2531&ResourceID=1333&site=1
- tar zxvf cgilib-0.5.tar.gz
- cd cgilib-0.5
- make
- cp libcgi.a /usr/local/lib
- cp cgi.h /usr/include
- 如果还不行,请看
- 第二:
- 安装libart_lgpl-devel这个包
- yum –y install libart_lgpl-devel
- 如果还报错configure: error: Please fix the library issues listed above and try again. 请看
- 第三:
- 把这两个包装上pango-devel cairo-devel
- yum –y install pango-devel* cairo-devel*
- 然后 在
- cd cd rrdtool-X.X.X
- ./configure --prefix=/usr/local/rrdtool
- 这样肯定能行,一般在第二部就能解决了。
- 如果还是不行的话,试试yum install libxml2-devel
- 我就是yum install libxml2-devel解决的
3.安装Spine
Spine 前身是Cactid,是纯C 编写的,是cmd.php 的替代品,目的是为了加快SNMP 轮询。如果你发现你的cmd.php 运行超过300 秒的话,推荐使用Spine。
Cacti数据采集方法:spine,cmd.php。cmd.php采集存在很大的延迟,执行效率太低了。两厢比较了一下,从添加device好到设备up,spine只需要不到一分钟,而cmd等的时间较长,超过10分钟。
一、安装Spine
(1)安装Spine依赖包
[root@test ~]# yum install openssl-devel mysql-devel net-snmp-devel
(2)源码安装Spine
[root@test ~]# cd /data1/
[root@test data1]# tar -xzf cacti-spine-0.8.8a.tar.gz
[root@test data1]# cd cacti-spine-0.8.8a
[root@test cacti-spine-0.8.8a]# ./configure --with-mysql=/usr/local/mysql/
[root@test cacti-spine-0.8.8a]# make && make instll
(3)Spine的配置文件spine.conf
[root@test cacti-spine-0.8.8a]# cd /usr/local/spine/etc/
[root@test etc]# mv spine.conf.dist spine.conf
[root@test etc]# vim spine.conf
DB_Host /tmp/mysql.sock
DB_Database cacti
DB_User cacti
DB_Pass cacti
DB_Port 3306
注意:
这个版本的spine默认使用/tmp/mysqld.sock登陆MySQL。而我的LNMP环境在编译MySQL时指定的为/tmp/mysql.sock。这时候可以用软链接的方法解决,也可以在spine.conf文件中指定sock文件,也就是修改DB_Host值为mysql.sock文件的位置。
(4)执行spine命令,检查是否正确
[root@test bin]# pwd
/usr/local/spine/bin
[root@test bin]# ./spine
出现下面类似信息,说明没有问题:
Poller[0] Time: 2.1460 s, Threads: 1, Hosts: 4
4、解压cacti,并移动到web目录下
[root@test ~]# cd /data1
[root@test data1]# tar -xzf cacti-0.8.8a.tar.gz
[root@test data1]# mv cacti-0.8.8a /data1/html/cacti
一定要把catci外面至少再有一层目录,不然最后web界面会登陆不上。
配置nginx,根目录指向/data1/html/cacti 即可。
4、在MySQL中创建数据库cacti
建立数据库cacti,并增加对该数据库拥有所有权限的用户名cacti,该用户密码为:cacti。
[root@test data1]# mysql -uroot -p
Enter password:
mysql> create database cacti default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on cacti.* to cacti@localhost identified by 'cacti';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on cacti.* to cacti@127.0.0.1 identified by 'cacti';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
5、创建系统用户cacti(根据情况决定是否创建用户)
[root@test data1]# useradd cacti
[root@test data1]# echo "cacti" | passwd --stdin cacti
Changing password for user cacti.
passwd: all authentication tokens updated successfully.
6、例行性排程设置
[root@test data1]# crontab –e –u nginx
*/1 * * * * /usr/local/php/bin/php /data1/html/cacti/poller.php > /dev/null
8、导入数据库到MySQL
[root@test html]# cd cacti/
[root@test cacti]# mysql -ucacti -pcacti cacti
9、修改cacti的配置脚本
[root@test cacti]# cd ..
[root@test html]# vim cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
10、cacti初始化配置以及安装
http://192.168.10.250/cacti/
一步一步配置即可
11.配置被监控 Linux 服务器1、安装net-snmp
[root@rhel ~]# yum install net-snmp
2、配置snmpd.conf文件
[root@rhel ~]# vim /etc/snmp/snmpd.conf
com2sec notConfigUser 监控服务器ip public
将其中62行的systemview改为all即可,并启用85行:
view all included .1 80
access notConfigGroup "" any noauth exact all none none
3、启动snmpd服务
[root@rhel ~]# chkconfig --level 35 snmpd on
[root@rhel ~]# service snmpd start
下一步,配置nagios,添加报警等功能。
- 实战cacti配置
- [Cacti] cacti监控Mongodb实战
- [Cacti] cacti监控mongodb性能实战
- Cacti简易安装配置
- CentOS+Cacti安装配置
- CentOS+Cacti安装配置
- Cacti简易安装配置
- Cacti安装与配置
- cacti安装/配置
- cacti/iostat环境配置
- cacti安装与配置
- cacti的安装配置
- cacti安装配置
- cacti安装与配置
- Cacti安装与配置
- 安装配置cacti
- Cacti安装配置#
- cacti安装配置
- 理解车削 3dmax
- 三层中的工厂接口架构分析
- Ultraedit文件大概不是dos格式
- CodeForces 251A Points on Line(二分)
- C#数据类型
- 实战cacti配置
- python Tkinter 的image问题
- MonetDB用户指南4——(资源)内存使用Memory footprint
- 高效合并两个有序数组
- IOS UILabel
- 利用稀疏矩阵的“三元组表”存储结构,实现两个矩阵的相加。
- 根据Econometrics in R一书,将回归方法总结一下
- Android 开发常用代码片段
- Java内省的使用(续)