Overview
Zabbix is an enterprise-level open-source solution that provides a web-based interface for monitoring distributed systems and networks. It monitors various network parameters to ensure the secure operation of server systems and offers flexible notification mechanisms to help system administrators quickly identify and resolve issues.
This topic describes how to deploy the Zabbix monitoring system using OceanBase Database as the meta database.
Version compatibility
- OceanBase Database version: ≥ V4.2.1
- Zabbix version: ≥ 7.x
Prerequisites
Before you use Zabbix to monitor OceanBase Database, make sure that:
You have deployed OceanBase Database and created a MySQL mode user tenant. For more information, see Create a tenant.
Procedure
Step 1: Obtain the database connection string
Contact the OceanBase Database deployment personnel to obtain the connection string. Example:
obclient -h$host -P$port -u$user_name -p$password -D$database_name
Parameter description:
$host: the IP address for connection. For ODP connection, use the ODP address. For direct connection, use the OBServer IP.$port: the port for connection. For ODP connection, the default value is2883. For direct connection, the default value is2881.$database_name: the name of the database.Notice
The user used to connect to the tenant must have the
CREATE,INSERT,DROP, andSELECTprivileges on the database. For more information about user privileges, see Privilege classification in MySQL mode.$user_name: the account for connection. For ODP connection, the format isuser@tenant#clusterorcluster:tenant:user. For direct connection, the format isuser@tenant.$password: the password of the account.
For more information about the connection string, see Connect to an OceanBase tenant by using OBClient.
Example:
obclient -hxxx.xxx.xxx.xxx -P2883 -utest_user001@mysql001 -p****** -Dtest
Step 2: Install and configure Zabbix
This topic uses Ubuntu 22.04 as an example to install Zabbix 7.4.
1. Add the Zabbix official repository
wget https://repo.zabbix.com/zabbix/7.4/release/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.4+ubuntu22.04_all.deb
dpkg -i zabbix-release_latest_7.4+ubuntu22.04_all.deb
apt update
2. Install Zabbix server, web frontend, and agent
apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
3. Create a database user and grant privileges
-- Connect to OceanBase Database
-- mysql -h$host -P2883 -utest_user001@mysql001 -p****** -Dtest
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@'%' identified by '$zabbix_password';
mysql> grant all privileges on zabbix.* to zabbix@'%';
mysql> quit;
4. Initialize the Zabbix SQL script in OceanBase Database
zcat /usr/share/zabbix/sql-scripts/mysql/server.sql.gz | mysql -h$host -P$odp_port -uzabbix@mysql001 -p$zabbix_password -D zabbix --default-character-set=utf8mb4
5. Configure the database for Zabbix server
Edit the configuration file /etc/zabbix/zabbix_server.conf:
# DBHost=
DBHost=$host
# DBPassword=
DBPassword=$zabbix_password
# DBPort=
DBPort=$odp_port
DBHost specifies the IP address in the OceanBase connection string. Example: 10.10.10.1. DBPort specifies the ODP port of OceanBase. Example: 2883. DBPassword specifies the password of the zabbix database user.
6. Start the Zabbix server and agent processes
Start the Zabbix server and agent processes, and set them to start automatically when the system boots:
systemctl restart zabbix-server zabbix-agent apache2
systemctl enable zabbix-server zabbix-agent apache2
# Verify whether the Zabbix server is started
systemctl status zabbix-server.service
Step 3: Access the Zabbix web interface to complete the installation
Open the Zabbix service address in a browser: http://localhost/zabbix
- On the Configure DB connection page, configure the database connection:
- Database type: MySQL
- Database host: the IP address of the OceanBase Database
- Database port: the ODP port of the OceanBase Database
- Database name: the name of the OceanBase Database
- User: the username of the OceanBase Database
- Password: the password of the OceanBase Database
- Click Next step and then Finish to complete the installation.
Step 4: Log in to and use Zabbix
- After the installation is complete, log in to Zabbix by using the default credentials:
- Username: Admin
- Password: zabbix
- After the login is successful, click
Monitoring/Hoststo view the metrics of the host where the Zabbix server is located.
Frequently Asked Questions
Q1: Cannot start Zabbix server due to an unsupported MySQL database version (5.06.25)
Cause: Zabbix requires a specific version of MySQL compatibility.
Solution: Modify the ODP parameters, log in to the sys tenant, and modify the mysql_version parameter:
obclient --default-character-set=utf8mb4 -u$user_name -p$password -h$host -P$port
alter proxyconfig set mysql_version='8.0.30';
Q2: Timeout during initialization of the zabbix SQL script
Cause: The SQL script execution time is too long, exceeding the default timeout setting.
Solution: Increase the Global ob_query_timeout or query_timeout:
obclient -h$host -P$port -uroot@mysql001 -p$password -e 'set global ob_query_timeout=1000000000;'
