Home » Linux » CentOS » Upgrade Zabbix 4.0 to 4.2

Upgrade Zabbix 4.0 to 4.2

On April 2, another new version of a cool and convenient monitoring system was released. Today I will tell you how to upgrade zabbix from version 4.0 to the latest version 4.2. Instructions will be detailed and step by step, with a description of all the nuances.

What’s new in zabbix version 4.2

Detailed information about zabbix 4.2 is in the announcement on the official site. I will comment in my own words what I personally found useful and interesting in the new version 4.2.

  • Prometheus support. This is a very cool step forward in development. Premeteus is a very popular modern monitoring system for container systems that are being actively developed and implemented. Zabbix made an important step by setting up a simple integration.
  • Optimize high frequency monitoring. Very handy thing that will save space in the database. As is known, the database is a bottleneck of the monitoring system. So a tool that will reduce the number of records without losing functionality is very useful.
  • Preprocessing data with JavaScript. Data processing can be done on the server in almost any form. It is less than scripts on places, it is more than processings on the server. It is more convenient to manage and scale the system. This is definitely a plus. Need to learn javascript.
  • Test preprocessing. Now you can configure the item, preprocessing and immediately see how it works. You do not have to wait for the element to be activated and data to start flowing. This saves debugging time.
  • Preprocessing on the proxy side. Everyone can understand it. We remove the load from the server and distribute it to the proxy.
  • Tags for templates and nodes. I personally use tags, so I am glad to extend this functionality. It will be more convenient to create lists based on some signs.
  • Test notification methods. It seems a little, but how annoying it is to debug notification methods when something does not work. We have to create some kind of trigger and constantly pull it to check the work. This is especially true for telegram notifications. Now you can check the alerts directly from the settings interface.
  • HTML format notifications. I always use text format. But I have seen people, who makes scripts for html alerts. Now it will work by default.
  • New filter in trigger configuration. The current filter is not really convenient, especially when there are hundreds of triggers on the host. I had to look for triggers through a list of items. First, you search for the desired item, then you go to the trigger. Item filter is more convenient. Now with triggers list all good too.
  • The exact time in graph tooltip. Finally did it. Now you can hover on the graph and see the exact time. On some graphs it is impossible to know exactly the time, if the step is large, the numbers in the time line are small. This issue has been resolved.
I draw attention to the fact that version 4.2 is not an LTS version. It’s support will be only 6 months, unlike LTS, where support is 5 years. So if you do not need a new functionality, you should not upgrade. After some time, you will have to be updated again.

Innovations are interesting and in some places I will update the server to test new features. Where the new functionality is not needed, I will not update it. I prefer to use the LTS version in production.

Innovations Zabbix 4.2 considered, proceed to update.

Preparing for the upgrade

If you have Zabbix version below 4.0, then first upgrade it to the 4.0. Before updating, we will make a database backup. To do this, first stop the server.

# systemctl stop zabbix-server
# /usr/bin/mysqldump --opt -v --databases zabbix -uzabbix -p'password' | /usr/bin/gzip -c > /root/zabbix.sql.gz
zabbix zabbix database name
-uzabbix key -u and then the database username
-p’password’ key -p and then the user’s DB password, if there are special characters in the password, escape them with single quotes

Save the admins page php scripts so that you can quickly run the old version in case of an emergency situation:

# cp -R /usr/share/zabbix /root

Centos 7

We connect the repository of the zabbix 4.2 version:

# rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm

Connecting zabbix 4.2 repository

The old repository from version 4.0 will be automatically deleted.

Clear and rebuild the yum cache:

# yum clean all
# yum makecache

Debian 9

Delete the current repository package:

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

We connect new:

# wget https://repo.zabbix.com/zabbix/4.2/debian/pool/main/z/zabbix-release/zabbix-release_4.2-1+stretch_all.deb
# dpkg -i zabbix-release_4.2-1+stretch_all.deb

Update information about repositories:

# apt update

Ubuntu 18

Delete the current repository package:

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

We connect new:

# wget https://repo.zabbix.com/zabbix/4.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.2-1+bionic_all.deb
# dpkg -i zabbix-release_4.2-1+bionic_all.deb

Update information about repositories:

# apt update

If you have other versions of the systems, then just find the package links for your version in the official repository – https://repo.zabbix.com/zabbix/4.2/ Further update will not differ from the current one.

Prepared for the update, you can proceed.

Installing update zabbix 4.0 to 4.2

Install the zabbix update on the Centos 7 server with the following command:

# yum upgrade zabbix-server-mysql zabbix-web zabbix-agent

This is a list of zabbix packages for the general case. If you have something else installed, it is better to update everything at once. You can view the list of installed zabbix packages with the command:

# rpm -qa | grep zabbix

In my case, there are still packages zabbix-get and zabbix-sender. We update everything at once:

# yum upgrade zabbix-server-mysql zabbix-web zabbix-agent zabbix-get zabbix-sender

Debian 9/Ubuntu 18

Install the zabbix update on Debian or Ubuntu server with the following command:

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

Further instruction is common for all systems. After the update is complete, start the server:

# systemctl start zabbix-server

At startup, the database will be updated. For a small base (1-2 GB) it does not take much time. You may not even notice the process. If the base is larger, then you need to wait until the update is complete. You can monitor it by viewing the log file of the zabbix server.

# tail -f /var/log/zabbix/zabbix_server.log

Upgrade zabbix 4.0 to 4.2

After the database update is completed, the server will start. After that, you can start the agent.

# systemctl start zabbix-agent

In the agent and server logs, you can see the version of the running services.

Starting Zabbix Agent [sysadminwork.com]. Zabbix 4.2.0 (revision 91746).
Starting Zabbix Server. Zabbix 4.2.0 (revision 91746).

Now you can go to the web interface and look at the updated version of the zabbix server. Before this, clear the browser cache and delete cookies from the page zabbix. If this is not done, then there may be problems and errors, which I have often saw.

If you use nginx as a web server, do not forget to change the owner of the /etc/zabbix/ web directory to nginx. After the upgrade, it will belong to apache, and the web interface will not work.

# chown -R nginx:nginx /etc/zabbix/web

At the bottom of the web interface, the current server version will be displayed:

Dashboard zabbix 4.2

You can see changes and uses new features.


Zabbix server upgrade procedure is usually not complicated. Problems most often arise in two cases:

  1. Problems with package dependencies, most often php or mysql.
  2. A large database that is updated for a very long time or is not updated for some reason.

The first problem is solved by manually removing or installing the necessary packages. There is no universal advice here. It depends on what you did on the server and why your dependencies are broken. The second problem is solved, depending on the causes of problems with the base. If it is too big and therefore everything slows down and lasts too long, you must either speed up the server or clean the base.

Sometimes the database is not updated due to some problems with the records. Most often in the fields of acknowledged, where you can write everything, anything. It is also necessary to understand the place and remove what prevents the update. But in general, the update goes smoothly and personally I have never had a problem with it.

I have a lot of articles on setting up zabbix. They are all in a zabbix category. I also have a detailed article on installing and configuring zabbix 4 with my examples and recommendations.

Leave a Reply

Your email address will not be published. Required fields are marked *

Нажимая кнопку "Отправить комментарий" Я даю согласие на обработку персональных данных.