1. Environmental preparation
1.1 System Requirements
- Oracle 19c database server
- Zabbix Server (version 5.0 or higher)
- Zabbix Agent 2
1.2 Prerequisites
- Oracle database is running normally
- Zabbix server is installed and configured
- Administrator permissions for Oracle database and server
2. Install Zabbix Agent 2
Install Zabbix Agent 2 on the Oracle database server.
# Add a Zabbix repositoryrpm -Uvh /zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1. # Install Zabbix Agent 2yum install zabbix-agent2 # Start the service and set the boot bootsystemctl start zabbix-agent2 systemctl enable zabbix-agent2
3. Configure Zabbix Agent 2
Edit configuration file/etc/zabbix/zabbix_agent2.conf
:
Server=<ZabbixserverIP> Hostname=<The host name of the machine>
Restart the Zabbix Agent 2 service:
systemctl restart zabbix-agent2
4. Create Oracle Monitoring Users
Log in to the Oracle database as a user with administrator privileges (such as SYS) and execute the following SQL statement:
-- Create a user CREATE USER C##zabbix_mon IDENTIFIED BY zabbix DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON users CONTAINER=ALL; -- Grant basic permissions GRANT CREATE SESSION TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ANY DICTIONARY TO C##zabbix_mon CONTAINER=ALL; -- Grant query permissions to specific objects GRANT SELECT ON SYS.DBA_TABLESPACE_USAGE_METRICS TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.DBA_TABLESPACES TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.DBA_USERS TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.DBA_DATA_FILES TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$ACTIVE_SESSION_HISTORY TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$ARCHIVE_DEST TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$ASM_DISKGROUP TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$DATABASE TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$DATAFILE TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$INSTANCE TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$LOG TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$OSSTAT TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$PGASTAT TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$PROCESS TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$SESSION TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$SYSMETRIC TO C##zabbix_mon CONTAINER=ALL; GRANT SELECT ON SYS.V_$SYSTEM_PARAMETER TO C##zabbix_mon CONTAINER=ALL;
5. Configure Oracle Monitoring
Create a file/etc/zabbix/zabbix_agent2.d/
:
.=tcp://localhost:1521 .=C##zabbix_mon .=zabbix .=cdb1
6. Configure environment variables
edit/etc/systemd/system/
File, in[Service]
Partially added:
Environment="ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1" Environment="LD_LIBRARY_PATH=/u01/app/oracle/product/19.0.0/dbhome_1/lib" Environment="PATH=$PATH:/u01/app/oracle/product/19.0.0/dbhome_1/bin"
Reload the systemd configuration and restart the service:
sudo systemctl daemon-reload sudo systemctl restart zabbix-agent2
7. Add host in the Zabbix web interface
- Log in to the Zabbix web interface
- Enter Configuration -> Hosts
- Click "Create host"
- Fill in the following information:
- Host name: <Oracle server name>
- Groups: Select the appropriate host group
- Interfaces: Add the Agent interface, fill in the IP address and port (default 10050)
- Add the Template DB Oracle by Zabbix agent 2 template in "Templates"
- Add the following macro in "Macros":
- {$} = tcp://localhost:1521
- {$} = cdb1
- {$} = C##zabbix_mon
- {$} = zabbix
- Click "Add" to save
8. Verification monitoring
- Enter Monitoring -> Latest data
- Select the Oracle host you just added
- Check whether there are Oracle-related monitoring items to start collecting data
9. Frequently Asked Questions and Solutions
9.1 Zabbix Agent 2 cannot connect to Oracle
symptom: "Cannot connect to Oracle" error appears in the Zabbix Agent 2 log.
Solution:
- Check whether the Oracle listener is running normally
- verify
Is the connection information in the correct one?
- Make sure the firewall allows Zabbix Agent 2 to access Oracle ports (usually 1521)
9.2 ORA-0000: DPI-1047 error
symptom: An error of "ORA-00000: DPI-1047: Cannot locate a 64-bit Oracle client library" appears.
Solution:
- Make sure the ORACLE_HOME and LD_LIBRARY_PATH environment variables are set correctly
- Check if the Oracle client library is 64-bit version
- Restart the Zabbix Agent 2 service
9.3 Insufficient permissions
symptom: Zabbix cannot collect certain Oracle metrics.
Solution:
- Check if the C##zabbix_mon user has sufficient permissions
- Some additional SELECT permissions may be required to be granted to some system views
9.4 Data collection delay
symptom: Oracle monitoring data is updated slowly.
Solution:
- Check the performance of Zabbix server and Agent
- Adjust data collection intervals
- Optimize Oracle query performance
9.5 User creation failed
symptom: An error occurred while creating C##zabbix_mon user.
Solution:
- Make sure to execute SQL statements that create users with sufficient permissions (such as SYS)
- Check whether the password complies with Oracle's password policy
- Make sure to execute commands in the correct container (if using a multi-tenant architecture)
9.6 Tablespace issues
symptom: The user created successfully but cannot be used.
Solution:
- Make sure that users and temp tablespaces exist and have sufficient space
- Check the user's quota settings
10. Conclusion
Through the above steps, you should be able to successfully configure Zabbix to monitor Oracle 19c databases. Remember to check monitoring data regularly and adjust the configuration in time to meet changing needs. If you encounter other problems, you can consult the official documents of Zabbix and Oracle or seek community help.
Notes:
- Ensure all passwords comply with security policies.
- Regularly review and update the permissions of monitor users.
- Keep Zabbix and Oracle software updated in a timely manner.
- Adjust monitoring items and triggers according to actual needs.
Through careful configuration and timely troubleshooting, you can establish a reliable Oracle database monitoring system to provide strong support for the stable operation of the database.
The above is the detailed content of the complete configuration guide for monitoring Oracle 19c database through Zabbix. For more information about monitoring Oracle 19c in Zabbix, please follow my other related articles!