Categorieën
Geen categorie

Upgrading Zabbix server from Ubuntu 12.04 to 14.04 (using a MySQL database)

So, I like Zabbix. Sue me 🙂

But upgrading is a whole different ballgame. Zabbix on Ubuntu 12.04 is version 1.8.1 and Zabbix on Ubuntu 14.04 is version 2.2.2. And Zabbix only does an automatic database upgrade from version 2.0 onwards. So, basically, you are on your own and Google does not seem to help either.

So, let me tell you what I did and maybe it works for you too. If not, I am sorry.

In the end I had to checkout the Zabbix sources to find a database patchfile.

So I did:

svn co svn://svn.zabbix.com/trunk

And I found the following directory:  trunk/upgrades/dbpatches/2.0

And it has a “upgrade” script. Don’t bother, it does not work as is. But there is also a “patch” subdirectory with a shitload of sql scripts. They turn out to be just the ticket. So I listed them al in a file, put a mysql command in from of them and, for safety, a “read” between every line and run the script.

So, my logging output in /var/log/zabbix-server/zabbix_server.log changed from:

6033:20140701:133019.785 WEB monitoring: YES
6033:20140701:133019.785 VMware monitoring: YES
6033:20140701:133019.785 Jabber notifications: YES
6033:20140701:133019.785 Ez Texting notifications: YES
6033:20140701:133019.785 ODBC: YES
6033:20140701:133019.785 SSH2 support: YES
6033:20140701:133019.785 IPv6 support: YES
6033:20140701:133019.785 ******************************
6033:20140701:133019.785 using configuration file: /etc/zabbix/zabbix_server.conf
6033:20140701:133019.789 Cannot upgrade database: the database must correspond to  version 2.0 or later. Exiting ...

to:

9446:20140701:151423.638 Starting Zabbix Server. Zabbix 2.2.2 (revision 42525).
9446:20140701:151423.638 ****** Enabled features ******
9446:20140701:151423.638 SNMP monitoring: YES
9446:20140701:151423.638 IPMI monitoring: YES
9446:20140701:151423.638 WEB monitoring: YES
9446:20140701:151423.638 VMware monitoring: YES
9446:20140701:151423.638 Jabber notifications: YES
9446:20140701:151423.638 Ez Texting notifications: YES
9446:20140701:151423.638 ODBC: YES
9446:20140701:151423.638 SSH2 support: YES
9446:20140701:151423.638 IPv6 support: YES
9446:20140701:151423.638 ******************************
9446:20140701:151423.638 using configuration file: /etc/zabbix/zabbix_server.conf
9446:20140701:151423.797 current database version (mandatory/optional):  02010000/02010000
9446:20140701:151423.797 required mandatory version: 02020000
9446:20140701:151423.797 starting automatic database upgrade
9446:20140701:151423.831 completed 0% of database upgrade
9446:20140701:151423.863 completed 1% of database upgrade
9446:20140701:151423.955 completed 2% of database upgrade
9446:20140701:151424.055 completed 3% of database upgrade
9446:20140701:151424.371 completed 4% of database upgrade
9446:20140701:151424.916 completed 5% of database upgrade
9446:20140701:151425.232 completed 6% of database upgrade
9446:20140701:151425.701 completed 7% of database upgrade

etc.
So, before you begin, please make a backup of your database first!

The script I used in the end was this one:

mysql -h mysqlhost -p -D zabbix -pmysqlpassword < acknowledges.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < actions.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < alerts.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < applications.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < auditlog_details.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < auditlog.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < autoreg_host.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < conditions.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < config.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < dchecks.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < dhosts.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < drules.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < dservices.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < escalations.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < events.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < expressions.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < functions.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < globalmacro.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < globalvars.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < graph_discovery.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < graphs_items.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < graphs.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < graph_theme.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < groups.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < help_items.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < history_log.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < history.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < history_str.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < history_str_sync.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < history_sync.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < history_text.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < history_uint.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < history_uint_sync.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < host_inventory.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < hostmacro.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < hosts_groups.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < hosts_profiles_ext.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < hosts_profiles.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < hosts.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < hosts_templates.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < housekeeper.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < httpstepitem.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < httpstep.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < httptestitem.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < httptest.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < icon_mapping.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < icon_map.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < ids.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < images.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < interface.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < item_discovery.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < items_applications.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < items.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < maintenances_groups.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < maintenances_hosts.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < maintenances.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < maintenances_windows.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < mappings.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < media.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < media_type.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < node_cksum.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < nodes.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < opcommand_grp.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < opcommand_hst.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < opconditions.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < operations.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < opgroup.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < opmediatypes.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < opmessage_grp.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < opmessage.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < opmessage_usr.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < optemplate.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < profiles.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < proxy_autoreg_host.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < proxy_dhistory.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < proxy_history.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < regexps.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < rights.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < screens_items.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < screens.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < scripts.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < service_alarms.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < services_links.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < services.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < services_times.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < sessions.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < slideshows.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < slides.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < sysmap_element_url.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < sysmaps_elements.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < sysmaps_links.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < sysmaps_link_triggers.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < sysmaps.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < sysmap_url.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < timeperiods.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < trends.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < trends_uint.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < trigger_depends.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < trigger_discovery.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < triggers.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < user_history.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < users_groups.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < users.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < usrgrp.sql
read dummy
mysql -h mysqlhost -p -D zabbix -pmysqlpassword < valuemaps.sql

After the update you are (almost) ready to go. When you get the url to /zabbix working in Apache he hits you with a configurator with lot of questions because he wants a /etc/zabbix/zabbix.conf.php file. Simply answer the questions and install the config file and you are good to go.

Enjoy!