Zabbix监控OpenGauss数据库指南

1.1、 简介

OpenGauss作为开源数据库官方支持使用zabbix作为监控运维系统,并提供了源码安装包的下载地址和操作指导。同样Zabbix也是开源软件并发布了许多成熟稳定的LTS版本。

 

1.2、 官方资料

https://opengauss.org/zh/blogs/justbk/2021-03-03_zabbix_for_openGauss.html

第2章、 安装ODBC驱动程序

2.1、 下载unixODBC源码包

https://www.unixodbc.org/

 

2.2、 编译源码包并安装

2.2.1、 解压

tar -xf unixODBC-2.3.1.tar.gz

2.2.2、 编译

cd unixODBC-2.3.1 && ./configure --prefix=/usr/local/unixODBC --sysconfdir=/etc

2.2.3、 安装

make && make install

2.3、 查看版本

odbcinst -j

odbcinst --version

:openGauss不支持unixODBC-2.2.1版本。

第3章、 安装openGauss驱动程序

3.1、 下载openGauss驱动

https://opengauss.org/zh/download/

 

3.2、 安装openGauss驱动

3.2.1、 解压

tar -zxvf openGauss-3.0.0-ODBC.tar.gz

3.2.2、 安装

cp lib/* /usr/local/lib/

cp odbc/lib/* /usr/local/lib/install

第4章、 配置ODBC驱动

ODBC相关配置文件有2个odbcinst.ini和odbc.ini。odbcinst.ini用于记录数据库驱动文件位置。odbc.ini用于记录数据库连接信息,例如数据库IP地址,用户名,密码等信息。

4.1、 修改驱动配置文件

vim /etc/odbcinst.ini

[openGauss]

Description = openGauss ODBC driver

Driver64 = /usr/local/lib/psqlodbcw.so

Setup = /usr/local/lib/psqlodbcw.so

4.2、 修改数据库连接文件

vim /etc/odbc.ini

[openGauss]

Description=ODBC for openGauss

Driver=openGauss #驱动名称

Servername=xxx.xxx.xxx.xxx #IP地址

Database=XXX #数据库

Username=xxxxxx #用户名

Password=xxxxxx #密码

Port=15400 #端口

Sslmode=allow

4.3、 远端连接配置

1、数据库部署在服务器上时,如果要允许其他电脑远程连接,则需要对openGauss进行配置,否则会出现如上FATAL: no pg_hba.conf entry for host"xxx.xxx.xxx.xxx".的错误;

2、根据提示可以找到pg_hba.conf文件,对其进行修改,将允许连接的ip地址配置到文件中的 #IPv4 local connections 即可;

3、如将ODBC客户端配置和要连接的数据库主节点在同一台服务器上,可使用local trust认证方式;

4、如将ODBC客户端配置和要连接的数据库主节点不在同一台服务器上,需要使用sha256认证方式;

第5章、 连接测试

5.1、 验证

isql -v openGauss

:测试成功后,在Zabbix界面配置odbc监控类型根据实际需求自定义

SQL语句即可监控。

posted @ 2023-03-18 15:13  呼长喜  阅读(249)  评论(0编辑  收藏  举报