Posted in Servers onSeptember 23, 2022
目录
前言
本文详细介绍了Zabbix6通过ODBC方式监控Oracle 19C的过程
? 1.19C客户端安装
✨ 1.1 19C客户端下载
#创建zabbix目录,进入zabbix目录
[root@jeames ~]# mkdir -p /zabbix
[root@jeames ~]# cd /zabbix
以下为官方下载地址
https://download.oracle.com/otn_software/linux/instantclient/199000/oracle-instantclient19.9-basic-19.9.0.0.0-1.x86_64.rpm
https://download.oracle.com/otn_software/linux/instantclient/199000/oracle-instantclient19.9-sqlplus-19.9.0.0.0-1.x86_64.rpm
https://download.oracle.com/otn_software/linux/instantclient/199000/oracle-instantclient19.9-devel-19.9.0.0.0-1.x86_64.rpm
https://download.oracle.com/otn_software/linux/instantclient/199000/oracle-instantclient19.9-odbc-19.9.0.0.0-1.x86_64.rpm
✨ 1.2 客户端安装
[root@jeames zabbix]# yum localinstall oracle-instantclient19.9-*
注意:实现配置好本地yum,请参考以下博客
Linux配置本地yum源,高效便捷
https://jeames.blog.csdn.net/article/details/120557997
#oracle-instantclient的安装位置如下
[root@jeames zabbix]# find / -name client64
/usr/lib/oracle/19.9/client64
/usr/share/oracle/19.9/client64
/usr/include/oracle/19.9/client64
? 2.数据库相关操作
✨ 2.1 确认监听状态
## 保证好数据库监听和实例是运行状态
[root@jeames ~]# su - oracle
[oracle@jeames ~]$ lsnrctl status
[oracle@jeames ~]$ lsnrctl start
✨ 2.2 实例名及服务名
SQL> show parameter name
SQL> show pdbs
✨ 2.3 Zabbix用户创建
--开PDB库
SQL> alter pluggable database PDB2 open;
SQL> select name,cdb from v$database;
--CDB切到PDB
SQL> alter session set container = PDB2;
SQL> create user zabbix identified by zabbix;
SQL> grant dba to zabbix;
? 3.客户端配置
注意:以下均在Zabbix Server做操作
✨ 3.1 配置环境变量
vi /etc/profile
cat >> /etc/profile << "EOF"
export ORACLE_HOME=/usr/lib/oracle/19.9/client64
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib64:/usr/lib:$ORACLE_HOME/bin
export TNS_ADMIN=$ORACLE_HOME/network/admin
EOF
#环境变量生效
[root@jeames ~]# source /etc/profile
## 驱动
chmod +x /usr/lib/oracle/19.9/client64/lib/libsqora.so.19.1
✨ 3.2 添加Oracle驱动
-- 配置odbcinst.ini文件信息:
[root@jeames ~]# vi /etc/odbcinst.ini
#添加如下内容
[Oracle]
Description = Oracle ODBC driver for Oracle 19c
Driver = /usr/lib/oracle/19.9/client64/lib/libsqora.so.19.1
--配置odbc.ini文件
[root@jeames ~]# odbcinst -j
unixODBC 2.3.1
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
[root@jeames ~]# rm -rf /root/.odbc.ini
cat >> /etc/odbc.ini << "EOF"
[ora19c]
Driver = Oracle
ServerName = 192.168.1.32:1521/pdb2
UserID = zabbix
Password = zabbix
Port= 1521
EOF
✨ 3.3 验证是否配置成功
[root@jeames ~]# isql -v ora19c
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
注:sqlplus 用户名/密码@IP/oracle数据库服务名 #如sqlplus zbbix/zbbix@IP:1521/cdb1
? 4.Zabbix监控
1.模板另存
配置-模板-Oracle by ODB-全克隆,此处另存为Oracle by ODBC 19C,点击应用户
2.配置主机
1)配置-主机-创建主机-选择模板Oracle by ODBC 19C
2)宏的地方做如下创建
{$ORACLE.DRIVER} Oracle
{$ORACLE.PASSWORD} zabbix
{$ORACLE.PORT} 1521
{$ORACLE.SERVICE} pdb2
{$ORACLE.USER} zabbix
{$HOST.CONN} 192.168.1.32
到此这篇关于Zabbix6通过ODBC方式监控Oracle 19C的详细过程的文章就介绍到这了,更多相关Zabbix ODBC监控Oracle内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!
Zabbix6通过ODBC方式监控Oracle 19C的详细过程
- Author -
IT邦德- Original Sources -
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@