Instalación y configuración del Plugins de Oracle para Zabbix-Agent2

From Zabbix-ES
Jump to navigation Jump to search

Instalación de Dockers en Oracle Linux 8

# dnf install -y dnf-utils zip unzip
# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
# dnf remove -y runc
# dnf install -y docker-ce --nobest
# systemctl enable --now docker.service

Instalación de Oracle 18c con Dockers

InfoDoc: https://www.oracle.com/lad/technical-resources/articles/database-performance/imagen-odb18c-en-docker.html
         https://soajp.blogspot.com/2019/03/instalar-oracle-database-18c-con-docker.html
 # docker pull dockerhelp/docker-oracle-ee-18c
 $ docker run -it -p 1521:1521 dockerhelp/docker-oracle-ee-18c bash
 $ sh post_install.sh
 $ sqlplus
 user: sys as sysdba
 pass: oracle
 SQL> alter session set "_ORACLE_SCRIPT"=true;
 Session altered.
 SQL> create user zabbix identified by zabbix1234;
 User created.
 SQL> grant dba to zabbix;
 Grant succeeded.
 SQL> select value from v$parameter where name='service_names';

Instalación y configuración de Zabbix-Agent2 con el plugin de Oracle

Instalación del Zabbix-Agent2

# rpm -Uvh https://repo.zabbix.com/zabbix/5.4/rhel/8/x86_64/zabbix-release-5.4-1.el8.noarch.rpm
# dnf install zabbix-agent2

# vi /etc/zabbix/zabbix_agent2.conf
Server=10.1.100.100
ServerActive=10.1.100.100

# systemctl enable zabbix-agent2

Instalamos paquetes necesarios

Instantclient de Oracle

Download: https://www.zabbix.com/documentation/current/manual/config/items/plugins
# mkdir -p /opt/oracle
# cd /opt/oracle
# wget https://download.oracle.com/otn_software/linux/instantclient/185000/instantclient-basic-linux.x64-18.5.0.0.0dbru.zip
# unzip instantclient-basic-linux.x64-*.zip

Librerías adicionales que utiliza el Instantclient

# dnf install -y libaio  libnsl


Configuracion del Plugin

Requisitos previos: https://www.zabbix.com/documentation/current/manual/config/items/plugins
                    https://oracle.github.io/odpi/doc/installation.html#linux

Linkeamos librerías

# echo /opt/oracle/instantclient_18_5 > /etc/ld.so.conf.d/oracle-instantclient.conf
# ldconfig

Creamos variables de entorno para el Zabbix-Agent2

# mkdir -p /etc/systemd/system/zabbix-agent2.service.d
# vi /etc/systemd/system/zabbix-agent2.service.d/oracle-env.conf
[Service]
Environment="ORACLE_HOME=/opt/oracle/instantclient_18_5"
Environment="LD_LIBRARY_PATH=/opt/oracle/instantclient_18_5:$LD_LIBRARY_PATH"
Environment="PATH=$PATH:$ORACLE_HOME"
# systemctl daemon-reload

Creamos en el Host en Zabbix Server y lo configuramos

Linkeamos el Template de Zabbix-Agent2

2021-11-11 16-20-00.jpg

Configuramos las macros del Plugin

2021-11-11 16-19-36.jpg

Arrancamos el Zabbix-Agent2

# systemctl restart zabbix-agent2 && tail -f /var/log/zabbix/zabbix_agent2.log