关于 Zabbix 服务器

Zabbix 是一款免费的开源网络监控软件工具,用于监控和跟踪 IT 基础设施的可用性和性能:服务器、网络设备和其他 IT 资产。

在本教程中,我们将介绍如何在 Ubuntu 16.04 LTS 或者 Ubuntu 18.04 LTS 上将 Zabbix Server 3.4.x 升级到 4.0.x。
这些步骤也可用于将 Zabbix Server 3.2.x 升级到 3.4.x 或者 4.0.x。

如何在 Ubuntu 16.04 LTS/Ubuntu 18.04 LTS 上将 Zabbix Server 3.4.x 升级到 4.0.x

5.升级Zabbix Server组件

要升级 Zabbix Server 组件,请运行以下命令:

# apt-get install --only-upgrade zabbix-server-mysql zabbix-frontend-php zabbix-agent

升级zabbix Server组件后,一定要像之前一样重新配置Zabbix Server配置文件zabbix_server.conf,apache2配置文件zabbix.conf。

6. 启动 Zabbix Server Daemon

# systemctl start zabbix-server

3.备份配置文件、PHP文件和Zabbix二进制文件

要备份 Zabbix Server 配置文件,请使用以下命令:

# cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/
# cp /etc/zabbix/zabbix_agentd.conf /opt/zabbix-backup/
# cp /etc/apache2/conf-enabled/zabbix.conf /opt/zabbix-backup/

要备份 PHP 文件和 Zabbix Server 二进制文件,请使用以下命令:

# cp -R /usr/share/zabbix//opt/zabbix-backup/
# cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/

4.更新Zabbix Server仓库配置包

卸载我们当前的 Zabbix 版本存储库,如下所示:

# rm -Rf /etc/apt/sources.list.d/zabbix.list

下载 Zabbix 存储库包版本:

# wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+xenial_all.deb
--2015-10-07 20:49:10--  https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+xenial_all.deb
Resolving repo.zabbix.com (repo.zabbix.com)... 162.243.159.138
Connecting to repo.zabbix.com (repo.zabbix.com)|162.243.159.138|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3930 (3.8K) [application/octet-stream]
Saving to: ‘zabbix-release_4.0-2+xenial_all.deb’
zabbix-release_4.0-2+xenial_all.deb       100%[==================================================================================>]   3.84K  --.-KB/s    in 0s
2015-10-07 20:49:11 (166 MB/s) - ‘zabbix-release_4.0-2+xenial_all.deb’ saved [3930/3930]

升级 Zabbix 当前存储库包版本如下:

# dpkg -i zabbix-release_4.0-1+xenial_all.deb
dpkg: error processing archive zabbix-release_4.0-1+xenial_all.deb (--install):
 cannot access archive: No such file or directory
Errors were encountered while processing:
 zabbix-release_4.0-1+xenial_all.deb
jack@onitroad:~# dpkg -i zabbix-release_4.0-2+xenial_all.deb
(Reading database ... 252597 files and directories currently installed.)
Preparing to unpack zabbix-release_4.0-2+xenial_all.deb ...
Unpacking zabbix-release (1:4.0-2+xenial) over (3.4-1+xenial) ...
Setting up zabbix-release (1:4.0-2+xenial) ...
Configuration file '/etc/apt/sources.list.d/zabbix.list'
 ==> Deleted (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** zabbix.list (Y/I/N/O/D/Z) [default=N] ? Y
Installing new version of config file /etc/apt/sources.list.d/zabbix.list ...

最后,使用以下命令更新存储库信息:

# apt-get update

2.备份现有的Zabbix数据库

创建一个目录,我们将其中备份 Zabbix Server 数据库和配置文件:

# mkdir /opt/zabbix-backup/

使用以下命令备份 Zabbix Server 数据库,将 zabbixdb 替换为 Zabbix Server 数据库名称:

# mysqldump -u root -p zabbixdb > /opt/zabbix-backup/zabbixdb.sql
Enter password:

1. 停止 Zabbix Server Daemon

停止 Zabbix Server 以确保没有新数据插入数据库:

# systemctl stop zabbix-server
日期:2020-06-02 22:19:02 来源:oir作者:oir