centos6.6 安装cacti监控服务器

原文链接: http://www.cnblogs.com/wayde-Z/p/5969885.html

整理一份cacti的安装步骤.留作笔记和以后参考用.

环境:

centos 6.6 -x64

cacti-0.8.8b-cn.tar.gz

mysql yum安装即可

yum服务使用centos自带的就行.如果是红帽请自行解决yum.本文不赘述.

 

**注意:同步好服务器的时间.免得后面加上监控服务器不出图.

 

1.安装基础服务(LAMP)

 #yum -y install mysql-server

1 Installed:
2   mysql-server.x86_64 0:5.1.73-7.el6
3 
4 Dependency Installed:
5   perl-DBD-MySQL.x86_64 0:4.013-3.el6                perl-DBI.x86_64 0:1.609-4.el6
6 
7 Complete!

安装httpd服务

# yum -y install httpd
Installed:
  httpd.x86_64 0:2.2.15-54.el6.centos
Dependency Installed:
  apr.x86_64 0:1.3.9-5.el6_2                     apr-util.x86_64 0:1.3.9-3.el6_0.1      apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1     
  httpd-tools.x86_64 0:2.2.15-54.el6.centos      mailcap.noarch 0:2.1.31-2.el6         

Complete!

安装php服务

 1 yum -y install php php-mysql
 2 Installed:
 3   php.x86_64 0:5.3.3-48.el6_8                                  
 4   php-mysql.x86_64 0:5.3.3-48.el6_8                                  
 5 
 6 Dependency Installed:
 7   php-cli.x86_64 0:5.3.3-48.el6_8
 8   php-common.x86_64 0:5.3.3-48.el6_8
 9   php-pdo.x86_64 0:5.3.3-48.el6_8          
10 
11 Complete!

检查以上软件是否安装成功

 1 [root@monitor-cacti ~]# rpm -qa |egrep 'php|httpd|mysql'
 2 mysql-5.1.73-7.el6.x86_64
 3 php-common-5.3.3-48.el6_8.x86_64
 4 php-pdo-5.3.3-48.el6_8.x86_64
 5 php-5.3.3-48.el6_8.x86_64
 6 mysql-libs-5.1.73-7.el6.x86_64
 7 mysql-server-5.1.73-7.el6.x86_64
 8 httpd-tools-2.2.15-54.el6.centos.x86_64
 9 httpd-2.2.15-54.el6.centos.x86_64
10 php-cli-5.3.3-48.el6_8.x86_64
11 php-mysql-5.3.3-48.el6_8.x86_64
12 [root@monitor-cacti ~]#

安装需要的库文件

 1 yum -y install zlib freetype libjpeg fontconfig gd libxml2 zlib freetype libjpeg fontconfig gd libxml2 php-gd
 2 
 3 Installed:
 4   fontconfig.x86_64 0:2.8.0-5.el6 freetype.x86_64 0:2.3.11-17.el6 gd.x86_64 0:2.0.35-11.el6 libjpeg-turbo.x86_64 0:1.2.1-3.el6_5
 5   php-gd.x86_64 0:5.3.3-48.el6_8 
 6 
 7 Dependency Installed:
 8   libX11.x86_64 0:1.6.3-2.el6     libX11-common.noarch 0:1.6.3-2.el6  libXau.x86_64 0:1.0.6-4.el6  libXpm.x86_64 0:3.5.10-2.el6 
 9   libpng.x86_64 2:1.2.49-2.el6_7  libxcb.x86_64 0:1.11-2.el6         
10 
11 Updated:
12   libxml2.x86_64 0:2.7.6-21.el6_8.1                                                                                                
13 
14 Complete!

如果yum安装都出现了Complete! 说明安装的没有问题.

2.安装rrd工具

 1 yum -y install rrdtool rrdtool-devel
 2 Installed:
 3   rrdtool.x86_64 0:1.3.8-7.el6                                  rrdtool-devel.x86_64 0:1.3.8-7.el6
 4 
 5 Dependency Installed:
 6   cairo.x86_64 0:1.8.8-6.el6_6                                       dejavu-fonts-common.noarch 0:2.33-1.el6
 7   dejavu-lgc-sans-mono-fonts.noarch 0:2.33-1.el6                     dejavu-sans-mono-fonts.noarch 0:2.33-1.el6
 8   fontpackages-filesystem.noarch 0:1.41-1.1.el6                      libXft.x86_64 0:2.3.2-1.el6
 9   libXrender.x86_64 0:0.9.8-2.1.el6_8.1                              libthai.x86_64 0:0.1.12-3.el6
10   pango.x86_64 0:1.28.1-11.el6                                       pixman.x86_64 0:0.32.8-1.el6
11 
12 Complete!

3.安装并配置监控需要的snmp工具

 1 #yum -y install net-snmp net-snmp-devel net-snmp-utils
 2 Installed:
 3   net-snmp.x86_64 1:5.5-57.el6_8.1       net-snmp-devel.x86_64 1:5.5-57.el6_8.1       net-snmp-utils.x86_64 1:5.5-57.el6_8.1      
 4 
 5 Dependency Installed:
 6   elfutils-devel.x86_64 0:0.164-2.el6      elfutils-libelf-devel.x86_64 0:0.164-2.el6   file-devel.x86_64 0:5.04-30.el6           
 7   keyutils-libs-devel.x86_64 0:1.4-5.el6   krb5-devel.x86_64 0:1.10.3-57.el6            libcom_err-devel.x86_64 0:1.41.12-22.el6  
 8   libselinux-devel.x86_64 0:2.0.94-7.el6   libsepol-devel.x86_64 0:2.0.41-4.el6         lm_sensors-devel.x86_64 0:3.1.1-17.el6    
 9   lm_sensors-libs.x86_64 0:3.1.1-17.el6    net-snmp-libs.x86_64 1:5.5-57.el6_8.1        openssl-devel.x86_64 0:1.0.1e-48.el6_8.3  
10   popt-devel.x86_64 0:1.13-7.el6           rpm-devel.x86_64 0:4.8.0-55.el6              tcp_wrappers-devel.x86_64 0:7.6-58.el6    
11   zlib-devel.x86_64 0:1.2.3-29.el6        
12 
13 Dependency Updated:
14   elfutils-libelf.x86_64 0:0.164-2.el6         elfutils-libs.x86_64 0:0.164-2.el6          file.x86_64 0:5.04-30.el6              
15   file-libs.x86_64 0:5.04-30.el6               krb5-libs.x86_64 0:1.10.3-57.el6            libselinux.x86_64 0:2.0.94-7.el6       
16   libselinux-python.x86_64 0:2.0.94-7.el6      libselinux-utils.x86_64 0:2.0.94-7.el6      openssl.x86_64 0:1.0.1e-48.el6_8.3     
17   rpm.x86_64 0:4.8.0-55.el6                    rpm-libs.x86_64 0:4.8.0-55.el6              rpm-python.x86_64 0:4.8.0-55.el6       
18   tcp_wrappers-libs.x86_64 0:7.6-58.el6       
19 
20 Complete!

配置snmp

1 vim /etc/snmp/snmpd.conf
2 com2sec notConfigUser  default       public
3 改为:com2sec notConfigUser  127.0.0.1       public
4 access  notConfigGroup ""      any       noauth    exact  systemview none none
5 改为:access  notConfigGroup ""      any       noauth    exact  all none none
6 #view all    included  .1                               80  去掉注释

启动服务并加如开机启动

1 #service httpd start
2 # service mysqld start
3 # service snmpd start
4 #chkconfig httpd on
5 #chkconfig mysqld on
6 #chkconfig snmpd on 

安装cacti

1 wget http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz
2 tar zxf cacti-0.8.8b-cn.tar.gz -C /var/www/html/
3 cd /var/www/html/
4 mv cacti-0.8.8b-cn/ cacti

初始化数据库

1 # mysql -u root
2 mysql> create database cacti;
3 mysql> grant all on cacti.* to cacti@localhost identified by 'cacti';
4 mysql> grant all on cacti.* to cacti@'127.0.0.1' identified by 'cacti';
5 mysql> flush privileges;
6 mysql> use cacti;
7 mysql> source cacti.sql;
8 mysql> quit

配置cacti

1 vim /var/www/html/cacti/include/config.php 
2 $database_type = "mysql";
3 $database_default = "cacti";
4 $database_hostname = "localhost";
5 $database_username = "cacti";
6 $database_password = "cacti";
7 $database_port = "3306";
8 
9 把配置文件里改成和这里一样的就可以了.

设置相关权限和计划任务.

1 useradd cacti -d /var/www/html/cacti -s /sbin/nologin
2 chown -R cacti /var/www/html/cacti/rra /var/www/html/cacti/log
3 echo '*/5 * * * * root /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1' >> /etc/crontab

初始化cacti

访问你的cacti.地址如下.红色替换成你的服务器ip

http://192.168.0.13/cacti

centos6.6 安装cacti监控服务器_第1张图片

如果显示的页面和这个一样.说明你前面配置的没有问题了.

直接点击next>>

centos6.6 安装cacti监控服务器_第2张图片

如果都显示ok则可以点击finish.如果有not found 则要看看是哪个命令或者路径不对.

finsh之后就是登录界面了,用户名和密码都是admin.

centos6.6 安装cacti监控服务器_第3张图片

第一次登录需要修改密码.如下

 centos6.6 安装cacti监控服务器_第4张图片

填入新密码保存即可.

这样cacti就安装完成了.

 

转载于:https://www.cnblogs.com/wayde-Z/p/5969885.html

你可能感兴趣的:(centos6.6 安装cacti监控服务器)