Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1734697
  • 博文数量: 150
  • 博客积分: 660
  • 博客等级: 上士
  • 技术积分: 2480
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-08 11:39
文章分类

全部博文(150)

文章存档

2019年(4)

2018年(36)

2017年(53)

2016年(7)

2015年(3)

2014年(3)

2013年(27)

2012年(2)

2011年(1)

2006年(1)

2005年(13)

分类: 系统运维

2013-12-06 13:57:08

zabbix 2.0 升级到2.2.0 


1、备份


 1、1 备份 原程序和配置文件
 
   mkdir zabbix_bak
   
   cp -R --parents /usr/local/sbin/zabbix* zabbix_bak/
   cp -R --parents /usr/local/bin/zabbix* zabbix_bak/
   
   
   
 1、2 验证备份
 
 tree zabbix_bak
zabbix_bak
└── usr
    └── local
        ├── bin
        │?? ├── zabbix_get
        │?? └── zabbix_sender
        ├── etc
        │?? ├── zabbix_agent.conf
        │?? ├── zabbix_agent.conf.d
        │?? ├── zabbix_agentd.conf
        │?? ├── zabbix_agentd.conf.d
        │?? ├── zabbix_server.conf
        │?? ├── zabbix_server.conf.20120627
        │?? └── zabbix_server.conf.d
        └── sbin
            ├── zabbix_agent
            ├── zabbix_agentd
            ├── zabbix_java
            │?? ├── bin
            │?? │?? ├── zabbix-java-gateway-2.0.0.jar
            │?? │?? └── zabbix-java-gateway-2.0.3.jar
            │?? ├── lib
            │?? │?? ├── logback-classic-0.9.27.jar
            │?? │?? ├── logback-console.xml
            │?? │?? ├── logback-core-0.9.27.jar
            │?? │?? ├── logback.xml
            │?? │?? ├── org-json-2010-12-28.jar
            │?? │?? └── slf4j-api-1.6.1.jar
            │?? ├── settings.sh
            │?? ├── shutdown.sh
            │?? └── startup.sh
            └── zabbix_server


11 directories, 20 files




 1、3 备份前端
 
 cp -R --parents /var/www/html/zabbix* zabbix_bak/
 tree zabbix_bak
 
 。。。。
 
 1.4 停止zabbix server 和mysqld
 
 service zabbix_server stop 
 service mysqld stop
 
 1.5 备份数据库
 
  为了节省时间,直接copy数据文件
 
  time cp -R --parents /var/lib/mysql /opt/     


real    9m6.400s
user    0m0.795s
sys     2m32.145s
 
 
2、升级


2.1  从官方仓库升级


rpm -ivh
Retrieving
warning: /var/tmp/rpm-tmp.y8Y1SL: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
Preparing...                ########################################### [100%]
   1:zabbix-release         ########################################### [100%]
[root@master opt]# yum update zabbix-server
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * epel: mirror.neu.edu.cn
 * extras: mirrors.btte.net
 * passenger: passenger.stealthymonkeys.com
 * rpmforge: mirror-fpt-telecom.fpt.net
 * updates: mirrors.btte.net
zabbix                                                                                                |  951 B     00:00     
zabbix/primary                                                                                        | 4.3 kB     00:00     
zabbix                                                                                                                 17/17
zabbix-non-supported                                                                                  |  951 B     00:00     
zabbix-non-supported/primary                                                                          | 3.1 kB     00:00     
zabbix-non-supported                                                                                                   14/14
Setting up Update Process
Package(s) zabbix-server available, but not installed.
No Packages marked for Update
[root@master opt]# yum install  zabbix-server  
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * epel: mirror.neu.edu.cn
 * extras: mirrors.btte.net
 * passenger: passenger.stealthymonkeys.com
 * rpmforge: mirror-fpt-telecom.fpt.net
 * updates: mirrors.btte.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package zabbix-server.x86_64 0:2.2.0-1.el6 will be installed
--> Processing Dependency: zabbix-server-implementation = 2.2.0-1.el6 for package: zabbix-server-2.2.0-1.el6.x86_64
--> Processing Dependency: zabbix = 2.2.0-1.el6 for package: zabbix-server-2.2.0-1.el6.x86_64
--> Processing Dependency: OpenIPMI-libs >= 2.0.14 for package: zabbix-server-2.2.0-1.el6.x86_64
--> Processing Dependency: iksemel for package: zabbix-server-2.2.0-1.el6.x86_64
--> Processing Dependency: unixODBC for package: zabbix-server-2.2.0-1.el6.x86_64
--> Running transaction check
---> Package OpenIPMI-libs.x86_64 0:2.0.16-14.el6 will be installed
---> Package iksemel.x86_64 0:1.4-2.el6 will be installed
---> Package unixODBC.x86_64 0:2.2.14-12.el6_3 will be installed
---> Package zabbix.x86_64 0:2.2.0-1.el6 will be installed
---> Package zabbix-server-pgsql.x86_64 0:2.2.0-1.el6 will be installed
--> Finished Dependency Resolution


Dependencies Resolved


=============================================================================================================================
 Package                              Arch                    Version                          Repository               Size
=============================================================================================================================
Installing:
 zabbix-server                        x86_64                  2.2.0-1.el6                      zabbix                   19 k
Installing for dependencies:
 OpenIPMI-libs                        x86_64                  2.0.16-14.el6                    base                    473 k
 iksemel                              x86_64                  1.4-2.el6                        epel                     48 k
 unixODBC                             x86_64                  2.2.14-12.el6_3                  base                    378 k
 zabbix                               x86_64                  2.2.0-1.el6                      zabbix                  135 k
 zabbix-server-pgsql                  x86_64                  2.2.0-1.el6                      zabbix                  1.5 M


Transaction Summary
=============================================================================================================================
Install       6 Package(s)


Total download size: 2.5 M
Installed size: 7.6 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): OpenIPMI-libs-2.0.16-14.el6.x86_64.rpm                                                         | 473 kB     00:00     
(2/6): iksemel-1.4-2.el6.x86_64.rpm                                                                   |  48 kB     00:00     
(3/6): unixODBC-2.2.14-12.el6_3.x86_64.rpm                                                            | 378 kB     00:00     
(4/6): zabbix-2.2.0-1.el6.x86_64.rpm                                                                  | 135 kB     00:02     
(5/6): zabbix-server-2.2.0-1.el6.x86_64.rpm                                                           |  19 kB     00:00     
(6/6): zabbix-server-pgsql-2.2.0-1.el6.x86_64.rpm                                                     | 1.5 MB     00:14     
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        132 kB/s | 2.5 MB     00:19     
warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
Importing GPG key 0x79EA5ED4:
 Userid : Zabbix SIA
 Package: zabbix-release-2.2-1.el6.noarch (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : unixODBC-2.2.14-12.el6_3.x86_64                                                                           1/6 
  Installing : zabbix-2.2.0-1.el6.x86_64                                                                                 2/6 
  Installing : OpenIPMI-libs-2.0.16-14.el6.x86_64                                                                        3/6 
  Installing : iksemel-1.4-2.el6.x86_64                                                                                  4/6 
  Installing : zabbix-server-2.2.0-1.el6.x86_64                                                                          5/6 
  Installing : zabbix-server-pgsql-2.2.0-1.el6.x86_64                                                                    6/6 


Installed:
  zabbix-server.x86_64 0:2.2.0-1.el6                                                                                         


Dependency Installed:
  OpenIPMI-libs.x86_64 0:2.0.16-14.el6     iksemel.x86_64 0:1.4-2.el6                   unixODBC.x86_64 0:2.2.14-12.el6_3    
  zabbix.x86_64 0:2.2.0-1.el6              zabbix-server-pgsql.x86_64 0:2.2.0-1.el6    


Complete!
 
 2、2 升级 agetn web get sender等
 
 yum install -y zabbix-web zabbix-agent zabbix-sender zabbix-get
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * epel: mirror.neu.edu.cn
 * extras: mirrors.btte.net
 * passenger: passenger.stealthymonkeys.com
 * rpmforge: mirror-fpt-telecom.fpt.net
 * updates: mirrors.btte.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package zabbix-agent.x86_64 0:2.2.0-1.el6 will be installed
---> Package zabbix-get.x86_64 0:2.2.0-1.el6 will be installed
---> Package zabbix-sender.x86_64 0:2.2.0-1.el6 will be installed
---> Package zabbix-web.noarch 0:2.2.0-1.el6 will be installed
--> Processing Dependency: zabbix-web-database = 2.2.0-1.el6 for package: zabbix-web-2.2.0-1.el6.noarch
--> Running transaction check
---> Package zabbix-web-mysql.noarch 0:2.2.0-1.el6 will be installed
--> Finished Dependency Resolution


Dependencies Resolved


=============================================================================================================================
 Package                            Arch                     Version                          Repository                Size
=============================================================================================================================
Installing:
 zabbix-agent                       x86_64                   2.2.0-1.el6                      zabbix                   150 k
 zabbix-get                         x86_64                   2.2.0-1.el6                      zabbix                    53 k
 zabbix-sender                      x86_64                   2.2.0-1.el6                      zabbix                    61 k
 zabbix-web                         noarch                   2.2.0-1.el6                      zabbix                   4.0 M
Installing for dependencies:
 zabbix-web-mysql                   noarch                   2.2.0-1.el6                      zabbix                    12 k


Transaction Summary
=============================================================================================================================
Install       5 Package(s)


Total download size: 4.3 M
Installed size: 24 M
Downloading Packages:
(1/5): zabbix-agent-2.2.0-1.el6.x86_64.rpm                                                            | 150 kB     00:01     
(2/5): zabbix-get-2.2.0-1.el6.x86_64.rpm                                                              |  53 kB     00:00     
(3/5): zabbix-sender-2.2.0-1.el6.x86_64.rpm                                                           |  61 kB     00:00     
(4/5): zabbix-web-2.2.0-1.el6.noarch.rpm                                                              | 4.0 MB     00:43     
(5/5): zabbix-web-mysql-2.2.0-1.el6.noarch.rpm                                                        |  12 kB     00:00     
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                         91 kB/s | 4.3 MB     00:48     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : zabbix-web-mysql-2.2.0-1.el6.noarch                                                                       1/5 
  Installing : zabbix-web-2.2.0-1.el6.noarch                                                                             2/5 
  Installing : zabbix-sender-2.2.0-1.el6.x86_64                                                                          3/5 
  Installing : zabbix-get-2.2.0-1.el6.x86_64                                                                             4/5 
  Installing : zabbix-agent-2.2.0-1.el6.x86_64                                                                           5/5 
warning: /etc/zabbix/zabbix_agentd.conf created as /etc/zabbix/zabbix_agentd.conf.rpmnew


Installed:
  zabbix-agent.x86_64 0:2.2.0-1.el6        zabbix-get.x86_64 0:2.2.0-1.el6        zabbix-sender.x86_64 0:2.2.0-1.el6       
  zabbix-web.noarch 0:2.2.0-1.el6         


Dependency Installed:
  zabbix-web-mysql.noarch 0:2.2.0-1.el6                                                                                      


Complete!




2.3 复制配置文件

cp /usr/local/etc/zabbix_server.conf  /etc/zabbix/

3、升级后检查


3、1 zabbix_server.conf
 
#复制原文件
     cp /usr/local/etc/zabbix_server.conf /etc/zabbix/
     #检查新旧配置文件,并修改参数同实际符合
     #mysql为例 
    
DBHost=localhost


DBName=zabbix


DBUser=root


DBSocket=/var/lib/mysql/mysql.sock


DBPort=3306


3、2 启动zabbix-server 
 
#rpm 安装 后服务启动文件为/etc/init.d/zabbix-server 
service zabbix-server start 
3.3 查看日志检查错误并修正
more /var/log/zabbix/zabbix_server.log
3.3.1 连接不上数据库,
1156:20131205:161701.066 Starting Zabbix Server. Zabbix 2.2.0 (revision 40163).
  1156:20131205:161701.066 ****** Enabled features ******
  1156:20131205:161701.067 SNMP monitoring:           YES
  1156:20131205:161701.067 IPMI monitoring:           YES
  1156:20131205:161701.067 WEB monitoring:            YES
  1156:20131205:161701.067 VMware monitoring:         YES
  1156:20131205:161701.067 Jabber notifications:      YES
  1156:20131205:161701.067 Ez Texting notifications:  YES
  1156:20131205:161701.067 ODBC:                      YES
  1156:20131205:161701.067 SSH2 support:              YES
  1156:20131205:161701.067 IPv6 support:              YES
  1156:20131205:161701.067 ******************************
  1156:20131205:161701.067 using configuration file: /etc/zabbix/zabbix_server.conf
  1156:20131205:161701.074 [Z3001] connection to database 'zabbix' failed: [0] could not connect to server: Connection refuse
d
        Is the server running on host "localhost" and accepting
        TCP/IP connections on port 5432?
could not connect to server: Connection refused
        Is the server running on host "localhost" and accepting
        TCP/IP connections on port 5432?
#反复检查mysql启动正常 和zabbix用户权限,根据错误提示5432端口,将配置文件的mysql的端口 显示配置为 DBPort=3306



3.3.2 连接数据库zabbix错误

4607:20131205:165136.040 Starting Zabbix Server. Zabbix 2.2.0 (revision 40163).
  4607:20131205:165136.040 ****** Enabled features ******
  4607:20131205:165136.040 SNMP monitoring:           YES
  4607:20131205:165136.040 IPMI monitoring:           YES
  4607:20131205:165136.041 WEB monitoring:            YES
  4607:20131205:165136.041 VMware monitoring:         YES
  4607:20131205:165136.041 Jabber notifications:      YES
  4607:20131205:165136.041 Ez Texting notifications:  YES
  4607:20131205:165136.041 ODBC:                      YES
  4607:20131205:165136.041 SSH2 support:              YES
  4607:20131205:165136.041 IPv6 support:              YES
  4607:20131205:165136.041 ******************************
  4607:20131205:165136.041 using configuration file: /etc/zabbix/zabbix_server.conf
  4607:20131205:165136.043 [Z3001] connection to database 'zabbix' failed: [0] could not connect to server: Connection refuse
d
        Is the server running on host "localhost" and accepting
        TCP/IP connections on port 3306?
received invalid response to SSL negotiation: 4

#修改日志debug级别为4,重启zabbix server继续查看日志


 8221:20131205:173126.684 Cannot connect to the database. Exiting...
 10220:20131205:174636.640 Starting Zabbix Server. Zabbix 2.2.0 (revision 40163).
 10220:20131205:174636.640 ****** Enabled features ******
 10220:20131205:174636.640 SNMP monitoring:           YES
 10220:20131205:174636.640 IPMI monitoring:           YES
 10220:20131205:174636.640 WEB monitoring:            YES
 10220:20131205:174636.640 VMware monitoring:         YES
 10220:20131205:174636.641 Jabber notifications:      YES
 10220:20131205:174636.641 Ez Texting notifications:  YES
 10220:20131205:174636.641 ODBC:                      YES
 10220:20131205:174636.641 SSH2 support:              YES
 10220:20131205:174636.641 IPv6 support:              YES
 10220:20131205:174636.641 ******************************
 10220:20131205:174636.641 using configuration file: /etc/zabbix/zabbix_server.conf
 10220:20131205:174636.641 In load_modules()
 。。。。。。
 
 
 10220:20131205:174746.661 PostgreSQL Server version: 0
 10220:20131205:174746.661 Database is down. Reconnecting in 10 seconds.
 10220:20131205:174752.373 Got signal [signal:15(SIGTERM),sender_pid:10281,sender_uid:0,reason:0]. Exiting ...
 10220:20131205:174752.373 zbx_on_exit() called
 10220:20131205:174754.373 In DBconnect() flag:1
 10220:20131205:174754.374 [Z3001] connection to database 'zabbix' failed: [0] could not connect to server: Connection refuse
d
        Is the server running on host "localhost" and accepting
        TCP/IP connections on port 3306?
received invalid response to SSL negotiation: 4


。。。。。。。。。。。

#发现原因,居然用postgres 的驱动去连mysql 。。。。。。。

#再检查配置文件根本没有设置连接postgres,只好检查安装过程,发现2.1的安装过程中却是安装了postgres的驱动,而没有安装mysql的驱动

#(6/6): zabbix-server-pgsql-2.2.0-1.el6.x86_64.rpm

#于是 
yum remove     zabbix-server-pgsql                                           
yum install    zabbix-server-mysql

#世界清净了,如下



 11708:20131205:175601.373 Starting Zabbix Server. Zabbix 2.2.0 (revision 40163).
 11708:20131205:175601.373 ****** Enabled features ******
 11708:20131205:175601.373 SNMP monitoring:           YES
 11708:20131205:175601.373 IPMI monitoring:           YES
 11708:20131205:175601.373 WEB monitoring:            YES
 11708:20131205:175601.374 VMware monitoring:         YES
 11708:20131205:175601.374 Jabber notifications:      YES
 11708:20131205:175601.374 Ez Texting notifications:  YES
 11708:20131205:175601.374 ODBC:                      YES
 11708:20131205:175601.374 SSH2 support:              YES
 11708:20131205:175601.374 IPv6 support:              YES
 11708:20131205:175601.374 ******************************
 11708:20131205:175601.374 using configuration file: /etc/zabbix/zabbix_server.conf
 11708:20131205:175601.433 current database version (mandatory/optional): 02010000/02010000
 11708:20131205:175601.433 required mandatory version: 02020000
 11708:20131205:175601.433 starting automatic database upgrade
 
4、zabbix前端的升级


   4.1 检查rpm安装的front web目录位置
  rpm -qa | grep zabbix-web
  rpm -ql zabbix-web-2.2.0-1.el6.noarch
  定位于/usr/share/zabbix
   
   4.2 停掉httpd
    service httpd stop
   4.3 升级
   
    #原目录 /var/www/html
    #备份
  cd /var/www/html
  mv zabbix20 zabbix20_V2.0.3
    #复制
    cp -R /usr/share/zabbix zabbix20
    #设置httpd访问权限
  chown apache:apache zabbix20
  #复制原配置文件
  ll zabbix20_V2.0.3/
  ll zabbix20_V2.0.3/conf
  cp zabbix20_V2.0.3/conf/*.php zabbix20/conf/
  ll zabbix20/conf/
  chown -R apache:apache zabbix20
       #重启httpd
  service httpd start
       #确认httpd已启动
  ps -ef | grep httpd
   4.4 浏览器登录前端验证
   
       发现还需要进行安装后的php连接mysql的设置,时候拷贝的原2.0.3的php配置文件不生效;
       配置同zabbix_server.conf内mysql相关的设置相同,配置完成后可以登录
阅读(10779) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~