cacti监控系统之一 cacti,snmp安装

说明:
Cacti通过 snmpget来获取数据,使用 RRDtool绘画图形,是一套基于PHP,MySQL,SNMP及RRDTool开发的网络流量监测图形分析工具。

实现:
1.yum安装LAMP,lnmp编统安装可以参考CentOS(x64)编译安装LNMP

# yum -y install httpd mysql-server php php-mysql mysql-devel
# chkconfig httpd on  //设置httpd开机启动
# chkconfig mysqld on
# /etc/init.d/httpd start  //启动httpd
# /etc/init.d/mysqld start

安装完成后,可通过以下程序测试

# cat index.php //内容如下

 
2.获取cacti及其配套软件获取

# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz
Rrdtool    http://oss.oetiker.ch/rrdtool/

# wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6.2/net-snmp-5.6.2.tar.gz
Net-snmp   http://www.net-snmp.org/

# wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz
Cacti      http://www.cacti.net/

 
3.安装rrdtool

# yum -y install cairo-devel libxml2-devel pango-devel  //Rrdtool安装需要cairo、libxml2、pango库支持,可通过yum安装
# tar zxvf rrdtool-1.4.7.tar.gz
# cd rrdtool-1.4.7
# ./configure --prefix=/usr/local/rrdtool
# make && make install
# ln -s /usr/local/rrdtool/bin/* /usr/local/bin/

 
4.安装net-snmp

# tar zxvf net-snmp-5.6.2.tar.gz
# cd net-snmp-5.6.1.1
# ./configure --prefix=/usr/local/net-snmp
./configure编译时,遇到checking for file... no configure: error: file program not found although it is needed by libtool,直接yum install -y file就可以了
# make && make install
# cp EXAMPLE.conf /etc/snmpd.conf
# ln -s /usr/local/net-snmp/bin/* /usr/local/bin/
# vim /etc/snmpd.conf
rocommunity public localhost //去掉注释
# /usr/local/net-snmp/sbin/snmpd -c /etc/snmpd.conf
# echo "/usr/local/net-snmp/sbin/snmpd -c /etc/snmpd.conf " >>/etc/rc.local  //加入开机启动

 
5.安装cacti

# tar zxvf cacti-0.8.8a.tar.gz
# mv cacti-0.8.8a/* /var/www/html/  //将cacti中的内容移到 web目录
# chown -R apache:apache /var/www/html/
# mysql -uroot -p  //连接到mysql创建数据库
> create database cacti;  //创建cacti数据库
> insert into mysql.user(host,user,password) values ('localhost','cacti',password('cacti123'));
//建立用户cacti,密码cacti123
> flush privileges;  //重载mysql授权表
> grant all on cacti.* to cacti@'localhost' identified by 'cacti123';  //把数据库cacti授权于用户cacti
# cd /var/www/html/
# mysql -ucacti -pcacti123 cacti

 
使用浏览器打开http://192.168.02/会看到安装向导,点下两个NEXT之后,出现以下:



6.默认用户admin,密码为cacti
忘记cacti登录密码可以参看:cacti忘记登录密码

附录:
暂空!

原文参考:
cacti安装与配置

发表评论

邮箱地址不会被公开。 必填项已用*标注