搭建Cacti监控系统(二)
http://blog.运维网.com/editor/icons/etc_19.gif 所需软件包下载:http://down.运维网.com/data/715338安装配置cacti
web根目录:/usr/local/nginx/html/
2.1 安装本机snmp相关服务
# yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils
# chkconfig --level 35 snmpdon
#service snmpd start
Starting snmpd:
# vim /etc/snmp/snmpd.conf
将default修改为127.0.0.1
com2sec notConfigUser127.0.0.1 public
将其中62行的systemview改为all即可
access notConfigGroup "" any noauth exact all none none
启用85行:view all included .1 80
2.2、安装rrdtool
(1)检查并安装相关依赖包
# yum -y install cairo-devel libxml2-devel pango-devel pango libpng-develfreetype freetype-devel libart_lgpl-devel pear pear-devel zlib libpng freetypelibart_lgpl libart_lgpl-devel libxml* pango*
(2)源码安装rrdtool
# tar -zxvfrrdtool-1.4.7.tar.gz
# cd rrdtool-1.4.7
#./configure --prefix=/usr/local/rrdtool
# make &&make install
2.3、解压cacti,并移动到web目录下
# tar zxvf cacti-0.8.8a.tar.gz
# mv cacti-0.8.8a/usr/local/nginx/html/cacti
2.4、在MySQL中创建数据库cacti
建立数据库cacti,并增加对该数据库拥有所有权限的用户名cacti,该用户密码为:cacti。
# /usr/local/mysql/bin/mysqladmin -u root password 123456
# /usr/local/mysql/bin/mysql -uroot -p123456
mysql>create database cacti;
QueryOK, 1 row affected (0.02 sec)
mysql>grant all on cacti.* to cacti@localhost identified by 'cacti';
QueryOK, 0 rows affected (0.02 sec)
mysql>grant all on cacti.* to cacti@127.0.0.1 identified by 'cacti';
QueryOK, 0 rows affected (0.00 sec)
mysql>flush privileges;
QueryOK, 0 rows affected (0.03 sec)
2.5、创建系统用户cacti(根据情况决定是否创建用户)
# useradd cacti
# echo "cacti" | passwd --stdin cacti
Changing password for user cacti.
passwd: all authentication tokens updatedsuccessfully.
2.6、例行性排程设置
# crontab -e
*/1 * * ** /usr/local/php/bin/php /usr/local/nginx/html/cacti/poller.php > /dev/null
2.7、修改cacti目录权限
# chown -R nginx:nginxcacti/
# chmod 777 cacti/rra -R
# chmod 777 cacti/log -R
2.8、导入数据库到MySQL
# mysql-ucacti -pcacti cacti Data Source -> 选择没有图像的数据源 -> Turn On Data Source Debug MTurnode
复制调试命令到监控端以cacti用户执行
执行后会生成rrd文件
http://blog.运维网.com/pmghong/../attachment/201303/112202755.jpg
# ls
localhost_load_1min_5.rrd localhost_mem_swap_4.rrdlocalhost_users_6.rrd
localhost_mem_buffers_3.rrdlocalhost_proc_7.rrd
p>
解决办法:
Console-> Data Source -> 选择没有图像的数据源 -> Turn On Data Source Debug MTurnode
复制调试命令到监控端以cacti用户执行
执行后会生成rrd文件
http://blog.运维网.com/pmghong/../attachment/201303/112304886.jpg
# ls
localhost_load_1min_5.rrd localhost_mem_swap_4.rrdlocalhost_users_6.rrd
localhost_mem_buffers_3.rrdlocalhost_proc_7.rrd
选择 Turn Off Data Source Debug MTurnode
随后查看监控界面,就会发现已生成图像:
http://blog.运维网.com/pmghong/../attachment/201303/112811994.jpg
默认情况下,cacti只监控本机,即cacti服务器,如上图所示!
至此,cacti 已经安装完成!
页:
[1]