Article reprinted from: http://mp.weixin.qq.com/s?__biz=MzA3MzYwNjQ3NA==&mid=2651296856&idx=1&sn= 2bdf780719d3bd913f80ebab18ada237&scene=23&srcid=0719kbxswrecyhxv3dbvsgss#rd
Here I am just as good as the article storage, do not do him with
Original 2016-07-19 South Africa spider OPS
Last write "Zabbix with good LLD, immediately feel tall on many", and recently encountered a need to monitor Oracle with Zabbix, some experience, record for later use.
This time still used the Zabbix LLD function, this function is: no LLD not Zabbix, strong to let people want to cry.
I. Problems of Orabbix and Zabora
Starting with Orabbix monitoring Oracle, the plugin's working mode is to configure the instance information, then a Java program, the process will be based on a well-defined query statement to obtain data, in trapper mode sent to Zabbix collection and presentation.
But there are several problems with Orabbix monitoring Oracle:
1, java program requires JRE environment, but the reality is: not all the machines have installed the JRE.
2, each instance needs to configure a host in the Zabbix, this is a non-humanized design.
3, Orabbix not within the framework of Zabbix, not under the unified management of Zabbix, to upgrade, configure the words are troublesome to die.
4. It is not possible to automatically discover all the table spaces of an instance.
5, the most terrible is the online many Chinese documents all have problems, go a lot of detours.
After a period of Orabbix time, decisive give up, the eyes turned to the Zabora plug-in, which is written with the Shell, Zabora design ideas can also, but write a bit humble, also can not meet my needs. Interested friends can search on GitHub, the world's largest gay dating site: Zabora
So, I'm going to build this wheel again.
Ii. monitoring the needs of Oracle
1. All DB instances can be automatically discovered and monitored
2, can automatically discover all the database instances in the table space, monitoring size and utilization
3. Flexibility to expand monitoring options
4, can be easily upgraded (if in the Zabbix framework, I have implemented the automatic upgrade function)
Third, design and function of the detailed
The first thing to look at is the architecture of an Oracle database, which is a bit different from what we used to do with MySQL.
There can be multiple instances in a database, each of which includes multiple users and more than one table space.
The item that we finally want to monitor should know at least the following information:
Instance name, database user name, database password, operating system user and environment file for managing database, if you want to monitor table space, you need the name of the tablespace.
It still sounds dizzy, let me comb this information.
Iv. the role of several major procedures:
1) 4 keys are defined in the key.conf file
The first key is used to find a couple of instances
The second key is used to obtain the values that need to be monitored in an instance
The third key is used to discover all the tablespaces in all instances.
The fourth key is used to get the size and utilization of the tablespace
2) oracle.conf defines the basic information of the instance
In fact, you can not have this file, but need to meet some conditions, fully do the association template automatically discovered and monitored.
But two conditions are required, interested friends can try:
The application discovers all instances and the user running the instance, this simple
Ps-ef|grep smon|grep-v Grep|awk ' {print $8} ' |awk-fora_smon_ ' {print $} '
Create a unified monitoring account and password for Zabbix in all databases, and then get the shell definition in the data or from the Zabbix web to the shell that gets the data.
3, discover_oracle_db.sh
Discover all instances and output JSON formatted data to Zabbix
4, discover_oracle_tb.sh
Discover all instances and tablespaces and output JSON format data to Zabbix
5. *.sql in SQL directory
All SQL files in the SQL directory are executed statements, so in the shell you do not see the specific execution statements, are called here, in the shell of the call syntax is probably the case:
Sqlplus-s ${db_user}/${db_pass} @/etc/zabbix/zabbix_agentd.d/script/sql/xxxxx.sql
If you need to expand monitoring, you need to add a corresponding SQL statement
V. Configuring monitoring items in the Zabbix Web
1, add two auto-discovery, a database instance auto-discovery, a database table space automatic discovery.
2, add the need to monitor the item and trigger, etc.
Vi. Effects in Latest data
Three X applications groups
Monitoring items in all instances
Usage of all tablespaces in all instances
Theoretically, this architecture can meet the requirements of multi-database instance (single instance, cluster instance), Multi-table space automatic discovery and monitoring.
Code I need to tidy up the release, because I do not understand Oracle, who if very understand, can help me to write some Oracle monitoring statements, I enrich the monitoring items, add me yunweibang008
In this thank Sohu Swim Yang Jianrong Classmate, he is also the industry well-known Oracle experts, help me to contribute a lot of Oracle SQL statement, below is his personal subscription number, there is a lot of dry goods, worth attention.
Zabbix fully automated monitoring of Oracle with LLD