Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to monitor Oracle database by Zabbix+Python

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how Zabbix+Python monitors the Oracle database. I hope you will get something after reading this article. Let's discuss it together.

I. Planning and monitoring items

The purpose of monitoring the database is to ensure the stable operation of the database. Once there is a fault, dba can find it in time and intervene to deal with it. The monitoring items are divided into the following two categories

1. Insufficient database space or database failure, DBA needs to be dealt with immediately.

Monitoring items include tablespace, user status, instance status, locks, a large number of waiting events, flashback area utilization, and so on. This kind of monitoring items need to be set up triggers, in the event of an exception, timely alarm.

two。 Some statistical information about the running status of the database provides a reference for DBA to locate the time and category of database performance problems.

Monitoring items include the number of common waiting events, hit rate, hard resolution ratio, and so on.

The monitoring items of the template in the attachment are listed in the table below

Second, installation and configuration steps

Environment description:

Measured environment Ubuntu 16 + Zabbix server 4.2 + python 3.5 + Oracle Client 19, monitored Oracle 11G and above

Install the oracle client

Oracle-instantclient-basic-linuxx64.rpm

Oracle-instantclient-devel-linuxx64.rpm

Oracle-instantclient-sqlplus-linuxx64.rpm

Configure environment variables

Vi + / etc/profile

-

Export ORACLE_HOME=/usr/lib/oracle/19.6/client64

Export LD_LIBRARY_PATH=$ORACLE_HOME/lib

Export PATH=$PATH:$ORACLE_HOME/bin

Execute the following command to make the configuration effective

Source / etc/profile

Add a dynamic library profile

Vi + / etc/ld.so.conf.d/oracle.conf

-

/ usr/lib/oracle/19.6/client64/lib

Execute the command ldconfig

Establish a TNS profile

Mkdir-p / usr/lib/oracle/19.6/client64/network/admin

Vi tnsnames.ora

Chown-R python:python / usr/lib/oracle/19.6/client64/network/admin

Configure environment variables

Vim / home/python/.bashrc

Add the following

Export ORACLE_HOME=/usr/lib/oracle/11.2/client64

Export TNS_ADMIN=$ORACLE_HOME/network/admin

Export NLS_LANG='simplified chinese_china'.ZHS16GBK

Export LD_LIBRARY_PATH=$ORACLE_HOME/lib

Export PATH=$ORACLE_HOME/bin:$PATH

Effective environment variable: source / home/python/.bashrc

Install python related packages, install cx_Oracle (python connection oracle package)

New version: https://github.com/oracle/python-cx_Oracle

Installation instructions: https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html

Root@zabbix: # python-m pip install cx_Oracle-- upgrade

Collecting cx_Oracle

Downloading https://files.pythonhosted.org/packages/82/a6/7cd37cdccf246/cx_Oracle-7.3.0-cp35-cp35m-manylinux1_x86_64.whl (736kB)

100% | ██ | 737kB 1.3MB/s

Installing collected packages: cx-Oracle

Successfully installed cx-Oracle-7.3.0

You are using pip version 9.0.3, however version 20.1 is available.

You should consider upgrading via the 'pip install-- upgrade pip' command.

Install argparse

Wget https://bootstrap.pypa.io/2.6/get-pip.py-- no-check-certificate

Python get-pip.py

Pip install argparse

-debug pip-

Root@zabbix:~# python3-version

Root@zabbix:~# sudo apt install python3-pip

Root@zabbix:~# pip3 show argparse

You are using pip version 8.1.1, however version 20.1 is available.

You should consider upgrading via the 'pip install-- upgrade pip' command.

Root@zabbix:~# pip3 install-upgrade pip

Collecting pip

Downloading https://files.pythonhosted.org/packages/54/2e/df11eaec8b9/pip-20.1-py2.py3-none-any.whl (1.5MB)

100% | ██ | 1.5MB 387kB/s

Installing collected packages: pip

Found existing installation: pip 8.1.1

Not uninstalling pip at / usr/lib/python3/dist-packages, outside environment / usr

Successfully installed pip-20.1

Root@zabbix:~# pip install argparse

Collecting argparse

Downloading argparse-1.4.0-py2.py3-none-any.whl (23 kB)

Installing collected packages: argparse

Successfully installed argparse-1.4.0

Root@zabbix:~# pip show argparse

Name: argparse

Version: 1.4.0

Summary: Python command-line parsing library

Home-page: https://github.com/ThomasWaldmann/argparse/

Author: Thomas Waldmann

Author-email: tw@waldmann-edv.de

License: Python Software Foundation License

Location: / usr/local/lib/python3.5/dist-packages

Requires:

Required-by:

Root@zabbix:~# python get-pip.py

Collecting pip

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report