Problem
You want to install and set up Zabbix 7.4 for monitoring of Oracle databases
This includes installing Zabbix 7.4 server and configuring of the ODBC libraries
Solution
1) Install Zabbix 7.4 in Docker containers:
Replace <zabbix_user_pwd> with your password for the Zabbix database account
docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 zabbix-net
docker run --name postgres-server -t \
-e POSTGRES_USER="zabbix" \
-e POSTGRES_PASSWORD="<zabbix_user_pwd>" \
-e POSTGRES_DB="zabbix" \
--network=zabbix-net \
--restart unless-stopped \
-d postgres:latest
docker run --name zabbix-server-pgsql -t \
-e DB_SERVER_HOST="postgres-server" \
-e POSTGRES_USER="zabbix" \
-e POSTGRES_PASSWORD="<zabbix_user_pwd>" \
-e POSTGRES_DB="zabbix" \
--network=zabbix-net \
-p 10051:10051 \
--restart unless-stopped \
--init \
-d zabbix/zabbix-server-pgsql:ubuntu-7.4-latest
docker run --name zabbix-web-nginx-pgsql -t \
-e ZBX_SERVER_HOST="zabbix-server-pgsql" \
-e DB_SERVER_HOST="postgres-server" \
-e POSTGRES_DB="zabbix" \
-e POSTGRES_USER="zabbix" \
-e POSTGRES_PASSWORD="<zabbix_user_pwd>" \
-e PHP_TZ="Europe/Budapest" \
--network=zabbix-net \
-p 3443:8443 \
-p 3080:8080 \
-v /etc/ssl/nginx:/etc/ssl/nginx:ro \
--restart unless-stopped \
-d zabbix/zabbix-web-nginx-pgsql:alpine-7.4-latest
2) Download Oracle Instant Client libraries:
https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
Required libraries:
instantclient-basiclite-*instantclient-odbc-*
instantclient-sqlplus-*
Match to your operating system and specific requirements.
Unzip downloaded archives into single folder, for example instantclient_19_29, and copy the folder into zabbix-server-pgsql container:
Create a folder to host Oracle Instant Client ODBC libraries in the zabbix server container:
$ docker exec -it -u 0 zabbix-server-pgsql bash
# mkdir -p /opt/oracle
# exit
$ docker cp instantclient_19_29 zabbix-server-pgsql:/opt/oracle/
Successfully copied 127MB (transferred 127MB) to 93fb013a6aee:/opt/oracle/
4) Configure ODBC libraries:
Log into container
$ docker exec -it -u 0 zabbix-server-pgsql bash
Inside the container:
# apt install libaio1t64
# ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1
# echo /opt/oracle/instantclient_19_29 > /etc/ld.so.conf.d/oracle.conf
# ldconfig
# apt install vim
# apt install unixodbc unixodbc-common unixodbc-dev
# vi /etc/odbcinst.ini
# cat /etc/odbcinst.ini
[ORA19DRIVER]
Description = Oracle 19 Instant Client ODBC Driver
Driver = /opt/oracle/instantclient_19_29/libsqora.so.19.1
# vi /etc/zabbix/zabbix_server_forks.conf
StartODBCPollers=20
# exit
Restart container:
$ docker restart zabbix-server-pgsql
5) In Zabbix create a template with these macros:
{$DBQ} - keep empty, later fill in with a database connect string, when a host inherits the macro
{$UID} - Zabbix database user account on target Oracle Database
{$PWD} - Zabbix database user password on target Oracle Database
6) Create a host with the template, the host will inherit the macros above, fill in {$DBQ}
7) Define items of type Database monitor, with keys template as:
db.odbc.select[<key_name>,dummy,Driver=ORA19DRIVER;DBQ={$DBQ};UID={$UID};PWD={$PWD}]
No comments:
Post a Comment