Upgrade Zabbix 1.8 to 2.2 on Ubuntu

This page contains notes for moving Zabbix 1.8.11 MySQL database, hosted on a Ubuntu 12.04 machine, to the new Ubuntu 14.04 server and upgrading to Zabbix version 2.2 LTS release.

Zabbix 2.2 is chosen due to an LTS release, which will be supported until November 2018. 

Software

Software used in this article:

  1. Ubuntu 12.04 with:
    1. Zabbix v1.8.11 (installed from source)
    2. MySQL server 5.5.41
    3. Apache 2.2.22
    4. PHP 5.3.10
  1. Ubuntu 14.04 with:
    1. Zabbix v2.2.2 (installed from repositories)
    2. MySQL server 5.5.41
    3. Apache 2.4.7
    4. PHP 5.5.9

On Ubuntu 12.04 Server

Backup the zabbix database on Ubuntu 12.04 server and copy it to the new Ubuntu 14.04 machine.

$ mysqldump -uzabbix -p zabbix | gzip > zabbix18.sql.gz

On Ubuntu 14.04 Server

Install MySQL Server and Restore Zabbix Database from the Backup

Install MySQL server:

$ sudo apt-get install mysql-server

At this point you may want to set innodb_file_per_table in the /etc/mysql/my.conf file to prevent ibdata1 growing crazy. MySQL 5.6 enables innodb_file_per_table by default.

Create a new zabbix database:

mysql> CREATE DATABASE zabbix;
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO "zabbix"@"localhost" IDENTIFIED BY "passwd";
mysql> FLUSH PRIVILEGES;

Restore zabbix dabatase from the backup:

$ mysql -uzabbix -p zabbix < zabbix18.sql

Apply MySQL Patch

Download the latest Zabbix source for v2.0 from http://www.zabbix.com/download2.php. At the time I write this it’s 2.0.14. Extract the archive.

Apply the SQL upgrade patch:

$ mysql -uzabbix -p zabbix < ./zabbix-2.0.14/upgrades/dbpatches/2.0/mysql/patch.sql

Note that there are no upgrade SQL scripts anymore when upgrading to Zabbix version 2.2 – database upgrade is performed by the Zabbix server.

Install Zabbix Server

Install Zabbix server with PHP frontend. This will install Zabbix server v2.2 from Ubuntu repositories.

$ sudo apt-get install zabbix-server-mysql zabbix-frontend-php \
apache2 php5 php5-gd php5-mysql fping

Create an Apache site file for Zabbix:

$ sudo touch /etc/apache2/sites-available/zabbix.conf

And add the following content:

<IfModule mod_alias.c>
    Alias /zabbix /usr/share/zabbix
</IfModule>

Enable Apache2 alias module:

$ sudo a2enmod alias

Enable zabbix site:

$ sudo a2ensite zabbix

Configure PHP

Open the /etc/php5/apache2/php.ini file and modify the following parameters (change timezone appropriately):

memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_execution_time = 300
max_input_time = 300
date.timezone = 'Europe/London'

These are pre-requisites for Zabbix v2.2.

Configure Zabbix Server

Configure Zabbix server. Example below.

$ grep -ve "^#" -ve "^$" /etc/zabbix/zabbix_server.conf
ListenPort=10051
LogFile=/var/log/zabbix-server/zabbix_server.log
DebugLevel=2
PidFile=/var/run/zabbix/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=passwd
DBPort=3306
ListenIP=0.0.0.0
HousekeepingFrequency=24
Timeout=3
AlertScriptsPath=/etc/zabbix/alert.d/
FpingLocation=/usr/bin/fping
TmpDir=/tmp
AllowRoot=0

Open the /etc/default/zabbix-server file with root privileges and enable Zabbix server to start from init.d script:

START=yes

Restart Apache:

$ sudo service apache2 restart

Start zabbix service:

$ sudo service zabbix-server start

Navigate to http://server-ip/zabbix to finish the installation. Download the configuration file and save it as /etc/zabbix/zabbix.conf.php.

Issues with Zabbix 2.2.2

The Template Trigger Name does not appear in Action Conditions search list (see https://support.zabbix.com/browse/ZBX-7399).

Download and install zabbix-frontend-php 2.2.4 or higher. Starting Zabbix 2.2.4, popups for value selection are reinstated alongside the auto-select fields.

Related Posts

Installing Zabbix 1.8.19 From Source on Debian Wheezy with PHP Frontend and HTTPS (LAMP Stack)