Overview
Zabbix is an enterprise-level open-source solution that provides distributed system monitoring and network monitoring capabilities through a web interface. It can monitor various network parameters, ensure the safe operation of server systems, and provide flexible notification mechanisms to help system administrators quickly locate and resolve various issues.
This topic describes how to deploy the Zabbix monitoring system using OceanBase Database as the metadata 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, for example:
obclient -h$host -P$port -u$user_name -p$password -D$database_name
Parameter description:
$host: the IP address for connecting to the database. For ODP connections, use the ODP address. For direct connections, use the OBServer IP address.$port: the port for connecting to the database. For ODP connections, the default port is2883. For direct connections, the default port 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 types in MySQL mode.$user_name: the username. For ODP connections, the format isuser@tenant#clusterorcluster:tenant:user. For direct connections, 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 example demonstrates how to install Zabbix 7.4 on Ubuntu 22.04.
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, for example, 10.10.10.1. DBPort specifies the ODP port of OceanBase Database, for 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:
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
Access the Zabbix service address in a browser: http://localhost/zabbix
- On the Configure DB connection page, configure the database connection:
- Database type: select MySQL.
- Database host: enter the IP address of the OceanBase Database.
- Database port: enter the ODP port of OceanBase Database.
- Database name: enter the name of the OceanBase Database.
- User: enter the username of the OceanBase Database.
- Password: enter 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 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.
FAQ
Q1: Zabbix server fails to start due to 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 Zabbix SQL script
Cause: The SQL script execution time exceeds 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;'
