A Zabbix database must be created during the installation of Zabbix server or proxy.
This section provides scripts for creating a Zabbix database. A separate schema script is provided for each supported database.
data.sql files are located in the database subdirectory of Zabbix sources. If Zabbix was installed from distribution packages, refer to the distribution documentation.
For a Zabbix proxy database, only
schema.sql should be imported (no images.sql nor data.sql)
shell> mysql -uroot -p<password> mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.* to [email protected] identified by '<password>'; mysql> quit; shell> mysql -uzabbix -p<password> zabbix < database/mysql/schema.sql # stop here if you are creating database for Zabbix proxy shell> mysql -uzabbix -p<password> zabbix < database/mysql/images.sql shell> mysql -uzabbix -p<password> zabbix < database/mysql/data.sql
We assume that a username user exists and has permissions to create database objects.
We assume that a zabbix database user with password password exists and has permissions to create database objects in ORCL service located on the host Oracle database server with a user shell user having write access to /tmp directory.
If you are creating a database for Zabbix server you need to have images somewhere on the Oracle host, for example in /tmp/zabbix_images folder. Copy all images from misc/images/png_modern to /tmp/zabbix_images directory on the Oracle host:
shell> cd /path/to/zabbix-sources shell> ssh [email protected] "mkdir /tmp/zabbix_images" shell> scp -r misc/images/png_modern [email protected]:/tmp/zabbix_images/
Edit the database/oracle/images.sql file and set
image_dir variable to the /tmp/zabbix_images path:
Now prepare the database:
shell> sqlplus zabbix/[email protected]/ORCL sqlplus> @database/oracle/schema.sql # stop here if you are creating database for Zabbix proxy sqlplus> @database/oracle/images.sql sqlplus> @database/oracle/data.sql
Zabbix requires a UTF-8 database character set. If database is not UTF-8, it can be converted by running:
ALTER DATABASE NATIONAL CHARACTER SET UTF8;
It is important to set UTF-8 locale for Zabbix server, Zabbix proxy and web server running Zabbix frontend. Otherwise text information from Zabbix will be interpreted by IBM DB2 server as non-UTF-8 and will be additionally converted on the way from Zabbix to the database and back. The database will store corrupted non-ASCII characters.
Zabbix frontend uses
LIMIT clauses in SQL queries. For this to work, IBM DB2 server must have DB2_COMPATIBILITY_VECTOR variable be set to 3. Run the following command before starting the database server:
If using SQLite with Zabbix proxy, database will be automatically created if it does not exist.
Return to the installation section.