zabbix从2.2.3升级到最新稳定版3.2.1

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

  2013年底很幸运进入我现在工作的单位。当时公司用的是zennos监控系统,由于当初zennos架构的设计和本身功能的限制,无法满足公司业务的需求。从2014开始负责zabbix监控系统测试,包括zabbix功能的研究、分布式部署和性能调优等工作。
  zabbix功能强大,可以监控包括系统、网络、硬件和应用等,自定义的key可监控到能想到的任何的监控项目。目前最新的稳定版本是3.2,由于3.0之后支持加密通信,趋势预测和更高大上的前端页面,所以打算将zabbix从2.2.3升级到3.2.1。
  目前zabbix监控的服务器数据量1000台左右,保存两年的历史数据,后台数据库2T。整个分布式监控系统有一台server,3台proxy和2台MySQL数据库,数据库一主一从,从库主要用作备份。由于zabbix 2.2.3的agent兼容3.2.1的,所有服务器客户端的agent均不需要升级,只需升级server和proxy。
  在升级之前首先检查一下zabbix 3.2.1所需要的MySQL数据库、PHP及其扩展库版本的要求。MySQL数据库的版本必须是5.0.3或者更新。前端页面对PHP和扩展库的要求如下:
wKioL1g7kMiQOvcgAAEiEUcyQE0997.jpg-wh_50

  如果上面要求都支持的话就可以进行升级了,在升级之前要做好数据的备份,方便在升级失败的时候快速回滚到2.2.3版本,备份的数据包括zabbix数据库,zabbix server配置文件,二进制文件和php文件,zabbix proxy的配置文件和二进制文件。
  在升级期间为了减少宕机时间和历史数据的丢失,官方推荐先停止zabbix server服务并升级zabbix server。然后在停止proxy服务并升级proxy之后启动proxy服务。这样一台proxy升级完在升级另外一台proxy,当所有proxy都升级完之后在启动zabbix server服务。
  第一步:升级zabbix server。
  1)停止zabbix server服务,确保没有数据insert到zabbix数据里面。
  2)备份zabbix数据库,由于数据库我做了MySQL主从同步,我只需要停止主从同步即可,从库就是备库。
  3)备份zabbix server的配置文件,前端页面的PHP文件和二进制启动文件。我这里推荐直接使用mv做备份。  

1
2
3
[root@monitor ~] # mv /etc/zabbix /etc/zabbix_version_2.2.3
[root@monitor ~] # mv /usr/local/zabbix /usr/local/zabbix_version_2.2.3
[root@monitor ~] # mv /data/www/zabbix /data/www/zabbix_version_2.2.3

  4)安装新的zabbix3.2.1的软件包。   

1
2
3
4
[root@monitor software] # tar -zxvf zabbix-3.2.1.tar.gz
[root@monitor software] # cd zabbix-3.2.1
[root@monitor zabbix-3.2.1] # ./configure --prefix=/usr/local/zabbix --sysconfdir=/etc/zabbix --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --enable-agent --enable-server --with-libcurl
[root@monitor zabbix-3.2.1] # make && make install

  5)参考2.2.3的配置文件修改zabbix server的配置文件。有些参数有变更,大部分参数都是一致的。确保配置文件的里面的数据库用户有足够的权限( create table, drop table, create index, drop index )。

  第二步:升级zabbix proxy。

  1)停止zabbix proxy服务。
  2)备份zabbix proxy的配置文件和二进制启动文件。我这里推荐直接使用mv做备份。 

1
2
[root@proxy01 ~] # mv /etc/zabbix /etc/zabbix_version_2.2.3
[root@proxy01 ~] # mv /usr/local/zabbix /usr/local/zabbix_version_2.2.3

  3) 安装新的zabbix3.2.1的软件包。   

1
2
3
4
[root@proxy01 software] # tar -zxvf zabbix-3.2.1.tar.gz
[root@proxy01 software] # cd zabbix-3.2.1
[root@proxy01 zabbix-3.2.1] # ./configure --prefix=/usr/local/zabbix --sysconfdir=/etc/zabbix --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --enable-agent --enable-proxy --with-libcurl
[root@proxy01 zabbix-3.2.1] # make && make install

  4)参考2.2.3的配置文件修改zabbix proxy的配置文件。有些参数有变更,大部分参数都是一致的。
  5)启动zabbix proxy服务,proxy会自动在后台升级数据库。查看proxy日志,直到升级完成。  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[root@proxy01 zabbix-3.2.1] # /usr/local/zabbix/sbin/zabbix_proxy
[root@proxy01 zabbix-3.2.1] # tail -f /data/logs/zabbix/zabbix_proxy.log
  47609:20161117:135742.277 Starting Zabbix Proxy (active) [shproxy01]. Zabbix 3.2.1 (revision 62890).
  47609:20161117:135742.277 **** Enabled features ****
  47609:20161117:135742.277 SNMP monitoring:       YES
  47609:20161117:135742.277 IPMI monitoring:        NO
  47609:20161117:135742.277 Web monitoring:        YES
  47609:20161117:135742.277 VMware monitoring:      NO
  47609:20161117:135742.277 ODBC:                   NO
  47609:20161117:135742.277 SSH2 support:           NO
  47609:20161117:135742.277 IPv6 support:           NO
  47609:20161117:135742.277 TLS support:            NO
  47609:20161117:135742.277 **************************
  47609:20161117:135742.277 using configuration  file /etc/zabbix/zabbix_proxy .conf
  47609:20161117:135742.311 current database version (mandatory /optional ): 02020000 /02020000
  47609:20161117:135742.311 required mandatory version: 03020000
  47609:20161117:135742.311 starting automatic database upgrade
  47609:20161117:135742.312 completed 0% of database upgrade
  ......
  47609:20161117:140415.027 completed 95% of database upgrade
  47609:20161117:140415.149 completed 96% of database upgrade
  47609:20161117:140415.251 completed 97% of database upgrade
  47609:20161117:140415.597 completed 98% of database upgrade
  47609:20161117:140415.815 completed 99% of database upgrade
  47609:20161117:140415.921 completed 100% of database upgrade
  47609:20161117:140415.921 database upgrade fully completed

  6)重复上面的1-5在升级其它两台proxy服务。

  第三步:所有的proxy服务都升级完成之后重启zabbix server服务。然后查看日志,如果出现database upgrade fully completed说明server升级成功。  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[root@monitor ~] # /usr/local/zabbix/sbin/zabbix_server   
[root@monitor ~] # tail -f /data/logs/zabbix/zabbix_server.log
  19002:20161117:144351.201 Starting Zabbix Server. Zabbix 3.2.1 (revision 62890).
  19002:20161117:144351.201 ****** Enabled features ******
  19002:20161117:144351.201 SNMP monitoring:           YES
  19002:20161117:144351.201 IPMI monitoring:            NO
  19002:20161117:144351.201 Web monitoring:            YES
  19002:20161117:144351.201 VMware monitoring:          NO
  19002:20161117:144351.201 SMTP authentication:        NO
  19002:20161117:144351.201 Jabber notifications:       NO
  19002:20161117:144351.201 Ez Texting notifications:  YES
  19002:20161117:144351.201 ODBC:                       NO
  19002:20161117:144351.201 SSH2 support:               NO
  19002:20161117:144351.201 IPv6 support:               NO
  19002:20161117:144351.201 TLS support:                NO
  19002:20161117:144351.201 ******************************
  19002:20161117:144351.201 using configuration  file /etc/zabbix/zabbix_server .conf
  19002:20161117:144351.213 current database version (mandatory /optional ): 02020000 /02020001
  19002:20161117:144351.213 required mandatory version: 03020000
  19002:20161117:144351.213 starting automatic database upgrade
  19002:20161117:144351.214 completed 0% of database upgrade
  19002:20161117:144351.501 completed 1% of database upgrade
  19002:20161117:144351.940 completed 2% of database upgrade
  ......
  19002:20161117:144807.873 completed 95% of database upgrade
  19002:20161117:144808.283 completed 96% of database upgrade
  19002:20161117:144808.541 completed 97% of database upgrade
  19002:20161117:144811.410 completed 98% of database upgrade
  19002:20161117:144812.120 completed 99% of database upgrade
  19002:20161117:144812.791 completed 100% of database upgrade
  19002:20161117:144812.791 database upgrade fully completed

  第四步:安装zabbix 前端WEB服务,一切都很顺利。

wKiom1g7kWPyhuqKAADMVYytShM581.jpg-wh_50

  总结:
  1)官方上虽然说zabbix 3.2.1的版本对php的要求是5.4.0或者更新,但发现如果PHP是5.4.24版本,会出现Last 20 issues不显示数据和前端页面有报错,但不影响功能,最后升级PHP到5.5.38版本解决了这个问题。

1
2
3
4
array_map() expects parameter 1 to be a valid callback, no array or string given [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CView->getOutput() → include() → make_system_status() → makeTriggersPopup() → CMacrosResolverHelper::resolveEventDescription() → CMacrosResolver->resolveTriggerNames() → CMacrosResolverGeneral->findFunctions() → CMacroParser->__construct() → array_map()  in  include /classes/parsers/CMacroParser .php:60]
Argument 1 passed to CSetParser::__construct() must be of the  type  array, null given, called  in  /data/online/zabbix/include/classes/parsers/CMacroParser .php on line 60 and defined [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CView->getOutput() → include() → make_system_status() → makeTriggersPopup() → CMacrosResolverHelper::resolveEventDescription() → CMacrosResolver->resolveTriggerNames() → CMacrosResolverGeneral->findFunctions() → CMacroParser->__construct() → CSetParser->__construct()  in  include /classes/parsers/CSetParser .php:43]
array_flip() expects parameter 1 to be array, null given [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CView->getOutput() → include() → make_system_status() → makeTriggersPopup() → CMacrosResolverHelper::resolveEventDescription() → CMacrosResolver->resolveTriggerNames() → CMacrosResolverGeneral->findFunctions() → CMacroParser->__construct() → CSetParser->__construct() → array_flip()  in  include /classes/parsers/CSetParser .php:44]
implode(): Argument must be an array [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CView->getOutput() → include() → make_system_status() → makeTriggersPopup() → CMacrosResolverHelper::resolveEventDescription() → CMacrosResolver->resolveTriggerNames() → CMacrosResolverGeneral->findFunctions() → CMacroParser->__construct() → CSetParser->__construct() → implode()  in  include /classes/parsers/CSetParser .php:45]

  2)检查php session是否有写的权限,如果没有写的权限,前端页面也会出错。










本文转自 sfzhang 51CTO博客,原文链接:http://blog.51cto.com/sfzhang88/1877197,如需转载请自行联系原作者

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
监控 应用服务中间件 nginx
教你在Zabbix环境下快速升级nginx版本!
1.环境描述原nginx版本:nginx 1.14.0升级后nginx版本:nginx 1.15.6nginx 官网:http://nginx.org/nginx 1.15.6直接下载链接:http://nginx.
1405 0
|
监控 关系型数据库 MySQL
|
3月前
|
存储 SQL 监控
修改Zabbix源码实现监控数据双写,满足业务需求!
虽然对接Elasticsearch后有诸多好处,但是它不往数据库写历史数据了,同时还不再计算趋势数据了。有这么一个场景...
修改Zabbix源码实现监控数据双写,满足业务需求!
|
4月前
|
数据采集 监控 数据库
OceanBase社区版可以通过Zabbix监控
OceanBase社区版可以通过Zabbix监控
77 4
|
4月前
|
监控 关系型数据库 机器人
小白带你学习linux的监控平台zabbix
小白带你学习linux的监控平台zabbix
136 0

推荐镜像

更多