技術ブログ
目次
Oracle ACE Proの渡部です。 Zabbixが標準で提供しているOracle監視方法である「Oracle by Zabbix agent 2」 (oracle_agent2)の概要と導入方法について説明します。 弊社では、多くのお客様にZabbixを用いたOracle監視を導入しております。
Oracle by Zabbix agent 2 (oracle_agent2)とは、Zabbix Agent 2で使用可能なOracle監視方式です。 Oracle by Zabbix agent 2の特徴は以下のとおりです。
監視処理はZabbix Agent 2に実装されており、監視動作のイメージは以下のようになります。
関連URLは以下のとおりです。
Oracle by Zabbix agent 2を導入して適用できる監視項目については、
に記載されています。主に、起動ステータス、使用率、セッション数などの量的な性能数値が収集されます。
Name | Description |
---|---|
Oracle: Ping | Test the connection to Oracle Database state |
Oracle: Version | Oracle Server version. |
Oracle: Uptime | Oracle instance uptime in seconds. |
Oracle: Instance status | Status of the instance. |
Oracle: Archiver state | Automatic archiving status. |
Oracle: Instance name | Name of the instance. |
Oracle: Instance hostname | Name of the host machine. |
Oracle: Instance role | Indicates whether the instance is an active instance or an inactive secondary instance. |
Oracle: Buffer cache hit ratio | Ratio of buffer cache hits. (LogRead - PhyRead)/LogRead |
Oracle: Cursor cache hit ratio | Ratio of cursor cache hits. CursorCacheHit/SoftParse |
Oracle: Library cache hit ratio | Ratio of library cache hits. Hits/Pins |
Oracle: Shared pool free % | Shared pool free memory percent. Free/Total |
Oracle: Physical reads per second | Reads per second. |
Oracle: Physical writes per second | Writes per second. |
Oracle: Physical reads bytes per second | Read bytes per second. |
Oracle: Physical writes bytes per second | Write bytes per second. |
Oracle: Enqueue timeouts per second | Enqueue timeouts per second. |
Oracle: GC CR block received per second | GC CR block received per second. |
Oracle: Global cache blocks corrupted | The number of blocks that encountered a corruption or checksum failure during interconnect. |
Oracle: Global cache blocks lost | The number of global cache blocks lost |
Oracle: Logons per second | The number of logon attempts. |
Oracle: Average active sessions | The average active sessions at a point in time. It is the number of sessions that are either working or waiting. |
Oracle: Active serial sessions | The number of active serial sessions. |
Oracle: Active parallel sessions | The number of active parallel sessions. |
Oracle: Long table scans per second | The number of long table scans per second. A table is considered 'long' if the table is not cached and if its high-water mark is greater than 5 blocks. |
Oracle: SQL service response time | SQL service response time in seconds. |
Oracle: User rollbacks per second | The number of times that users manually issue the ROLLBACK statement or an error occurred during a user's transactions. |
Oracle: Total sorts per user call | Total sorts per user call. |
Oracle: Rows per sort | The average number of rows per sort for all types of sorts performed. |
Oracle: Disk sort per second | The number of sorts going to disk per second |
Oracle: Memory sorts ratio | The percentage of sorts (from ORDER BY clauses or index building) that are done to disk vs in-memory. |
Oracle: Database wait time ratio | Wait time: the time that the server process spends waiting for available shared resources (to be released by other server processes) such as latches, locks, data buffers, and so on |
Oracle: Database CPU time ratio | Calculated by dividing the total CPU used by the database by the Oracle time model statistic DB time. |
Oracle: Temp space used | Temp space used. |
Oracle: Sessions limit | User and system sessions. |
Oracle: Datafiles limit | Max allowable number of datafile. |
Oracle: Processes limit | Max user processes. |
Oracle: Session count | Session count. |
Oracle: Active user sessions | The number of active user sessions. |
Oracle: Active background sessions | The number of active background sessions. |
Oracle: Inactive user sessions | The number of inactive user sessions. |
Oracle: Sessions lock rate | The percentage of locked sessions. Locks are mechanisms that prevent destructive interaction between transactions accessing the same resource?either user objects such as tables and rows or system objects not visible to users, such as shared data structures in memory and data dictionary rows. |
Oracle: Sessions locked over {$ORACLE.SESSION.LOCK.MAX.TIME}s | Count of the prolongedly locked sessions. (You can change maximum session lock duration in seconds for query by {$ORACLE.SESSION.LOCK.MAX.TIME} macro. Default 600 sec) |
Oracle: Sessions concurrency | The percentage of concurrency. Concurrency is a DB behavior when different transactions request to change the same resource - in case of modifying data transactions sequentially block temporarily the right to change data, the rest of the transactions are waiting for access. In the case when access for resource is locked for a long time, then the concurrency grows (like the transaction queue) and this often has an extremely negative impact on performance. A high contention value does not indicate the root cause of the problem, but is a signal to search for it. |
Oracle: PGA, Total inuse | Indicates how much PGA memory is currently consumed by work areas. This number can be used to determine how much memory is consumed by other consumers of the PGA memory (for example, PL/SQL or Java). |
Oracle: PGA, Aggregate target parameter | Current value of the PGA_AGGREGATE_TARGET initialization parameter. If this parameter is not set, then its value is 0 and automatic management of PGA memory is disabled. |
Oracle: PGA, Total allocated | Current amount of PGA memory allocated by the instance. The Oracle Database attempts to keep this number below the value of the PGA_AGGREGATE_TARGET initialization parameter. However, it is possible for the PGA allocated to exceed that value by a small percentage and for a short period of time when the work area workload is increasing very rapidly or when PGA_AGGREGATE_TARGET is set to a small value. |
Oracle: PGA, Total freeable | Number of bytes of PGA memory in all processes that could be freed back to the operating system. |
Oracle: PGA, Global memory bound | Maximum size of a work area executed in automatic mode. |
Oracle: FRA, Space limit | Maximum amount of disk space (in bytes) that the database can use for the fast recovery area. |
Oracle: FRA, Used space | Amount of disk space (in bytes) used by fast recovery area files created in current and all previous fast recovery areas. |
Oracle: FRA, Space reclaimable | Total amount of disk space (in bytes) that can be created by deleting obsolete, redundant, and other low priority files from the fast recovery area. |
Oracle: FRA, Number of files | Number of files in the fast recovery area |
Oracle: FRA, Usable space in % | |
Oracle: FRA, Number of restore points | |
Oracle: SGA, java pool | Memory is allocated from the java pool. |
Oracle: SGA, large pool | Memory is allocated from the large pool. |
Oracle: SGA, shared pool | Memory is allocated from the shared pool. |
Oracle: SGA, log buffer | The number of bytes allocated for the redo log buffer. |
Oracle: SGA, fixed | The fixed SGA is an internal housekeeping area. |
Oracle: SGA, buffer cache | The size of the cache of standard blocks. |
Oracle: User's expire password | The number of days before zabbix account password expired. |
Oracle: Redo logs available to switch | Number of available for log switching inactive/unused REDO logs. |
Oracle: Number of processes | |
Oracle: Datafiles count | Current number of datafile. |
Oracle Database '{#DBNAME}': Open status | 1 - 'MOUNTED', 2 - 'READ WRITE', 3 - 'READ ONLY', 4 - 'READ ONLY WITH APPLY' (A physical standby database is open in real-time query mode) |
Oracle Database '{#DBNAME}': Role | Current role of the database, 1 - 'SNAPSHOT STANDBY', 2 - 'LOGICAL STANDBY', 3 - 'PHYSICAL STANDBY', 4 - 'PRIMARY ', 5 -'FAR SYNC' |
Oracle Database '{#DBNAME}': Log mode | Archive log mode, 0 - 'NOARCHIVELOG', 1 - 'ARCHIVELOG', 2 - 'MANUAL' |
Oracle Database '{#DBNAME}': Force logging | Indicates whether the database is under force logging mode (YES) or not (NO) |
Oracle Database '{#DBNAME}': Open status | 1 - 'MOUNTED', 2 - 'READ WRITE', 3 - 'READ ONLY', 4 - 'READ ONLY WITH APPLY' (A physical standby database is open in real-time query mode) |
Oracle TBS '{#TABLESPACE}': Tablespace allocated, bytes | Currently allocated bytes for tablespace (sum of the current size of datafiles). |
Oracle TBS '{#TABLESPACE}': Tablespace MAX size, bytes | Maximum size of tablespace. |
Oracle TBS '{#TABLESPACE}': Tablespace used, bytes | Currently used bytes for tablespace (current size of datafiles-free space). |
Oracle TBS '{#TABLESPACE}': Tablespace free, bytes | Free bytes of allocated space. |
Oracle TBS '{#TABLESPACE}': Tablespace usage, percent | Used bytes/Allocated bytes*100 |
Oracle TBS '{#TABLESPACE}': Tablespace allocated, percent | Allocated bytes/Max bytes*100 |
Oracle TBS '{#TABLESPACE}': Open status | Tablespace status. 1 - 'ONLINE' 2 - 'OFFLINE' 3- 'READ ONLY' |
Archivelog '{#DEST_NAME}': Error | Displays the error text |
Archivelog '{#DEST_NAME}': Last sequence | Identifies the sequence number of the last archived redo log to be archived |
Archivelog '{#DEST_NAME}': Status | Identifies the current status of the destination: 1 - 'Valid', 2 - 'Deferred',3 - 'Error', 0 - 'Unknown' |
ASM '{#DG_NAME}': Total size | Total size of ASM disk group. |
ASM '{#DG_NAME}': Free size | Free size of ASM disk group. |
ASM '{#DG_NAME}': Free size | Usage percent of ASM disk group. |
Oracle: Get instance state | The item gets state of the current instance. |
Oracle: Get system metrics | The item gets system metric values. |
Oracle: Get system parameters | Get a set of system parameter values. |
Oracle: Get sessions stats | Get sessions statistics. {$ORACLE.SESSION.LOCK.MAX.TIME} -- maximum seconds in the current wait condition for counting long time locked sessions. Default: 600 seconds. |
Oracle: Get PGA stats | Get PGA statistics. |
Oracle: Get FRA stats | Get FRA statistics. |
Oracle: Get SGA stats | Get SGA statistics. |
Oracle: Get tablespaces stats | Get tablespaces stats. |
Oracle: Get CDB and No-CDB info | Get info about CDB and No-CDB databases on instance. |
Oracle: Get PDB info | Get info about PDB databases on instance. |
Oracle: Get archive log info | |
Oracle: Get ASM stats | Get ASM disk groups stats. |
インストール手順は以下にざっくり記載されていますが、若干不親切です。
具体的な手順を以下に示します。
監視対象ホストにZabbix Agent 2をインストールします。
[root@l8dpa223ad1 ~]# rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-2.el8.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-2.el8.noarch.rpm
dnf clean all
warning: /var/tmp/rpm-tmp.CFIcv8: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-6.0-2.el8 ################################# [100%]
[root@l8dpa223ad1 ~]# dnf clean all
184 files removed
[root@l8dpa223ad1 ~]#
[root@l8dpa223ad1 ~]# yum install zabbix-agent2.x86_64
Oracle Linux 8 Application Stream (x86_64) 9.6 MB/s | 7.2 MB 00:00
Oracle Linux 8.5 BaseOS (x86_64) 12 MB/s | 3.3 MB 00:00
Zabbix Official Repository - x86_64 82 kB/s | 107 kB 00:01
Zabbix Official Repository non-supported - x86_64 1.3 kB/s | 1.2 kB 00:00
Zabbix Official Repository (Agent2 Plugins) - x86_64 1.2 kB/s | 1.1 kB 00:00
Dependencies resolved.
=======================================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================================
Installing:
zabbix-agent2 x86_64 6.0.7-1.el8 zabbix 5.3 M
Transaction Summary
=======================================================================================================================================
Install 1 Package
Total download size: 5.3 M
Installed size: 19 M
Is this ok [y/N]: y
Downloading Packages:
zabbix-agent2-6.0.7-1.el8.x86_64.rpm 1.0 MB/s | 5.3 MB 00:05
---------------------------------------------------------------------------------------------------------------------------------------
Total 1.0 MB/s | 5.3 MB 00:05
Zabbix Official Repository - x86_64 1.6 MB/s | 1.7 kB 00:00
Importing GPG key 0xA14FE591:
Userid : "Zabbix LLC "
Fingerprint: A184 8F53 52D0 22B9 471D 83D0 082A B56B A14F E591
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: zabbix-agent2-6.0.7-1.el8.x86_64 1/1
Installing : zabbix-agent2-6.0.7-1.el8.x86_64 1/1
Running scriptlet: zabbix-agent2-6.0.7-1.el8.x86_64 1/1
Verifying : zabbix-agent2-6.0.7-1.el8.x86_64 1/1
Installed:
zabbix-agent2-6.0.7-1.el8.x86_64
Complete!
[root@l8dpa223ad1 ~]# cp -p /etc/zabbix/zabbix_agent2.conf{,.20220823BK}
[root@l8dpa223ad1 ~]# vi /etc/zabbix/zabbix_agent2.conf
[root@l8dpa223ad1 ~]# diff /etc/zabbix/zabbix_agent2.conf{,.20220823BK}
80c80
< Server=172.31.34.31
---
> Server=127.0.0.1
132c132
< ServerActive=172.31.34.31
---
> ServerActive=127.0.0.1
[root@l8dpa223ad1 ~]# systemctl start zabbix-agent2
[root@l8dpa223ad1 ~]# systemctl status zabbix-agent2
● zabbix-agent2.service - Zabbix Agent 2
Loaded: loaded (/usr/lib/systemd/system/zabbix-agent2.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2022-08-23 20:57:55 JST; 4s ago
Main PID: 2456 (zabbix_agent2)
Tasks: 6 (limit: 48694)
Memory: 3.9M
CGroup: /system.slice/zabbix-agent2.service
mq2456 /usr/sbin/zabbix_agent2 -c /etc/zabbix/zabbix_agent2.conf
Aug 23 20:57:55 l8dpa223ad1.domain systemd[1]: Started Zabbix Agent 2.
Aug 23 20:57:55 l8dpa223ad1.domain zabbix_agent2[2456]: Starting Zabbix Agent 2 (6.0.7)
Aug 23 20:57:55 l8dpa223ad1.domain zabbix_agent2[2456]: Zabbix Agent2 hostname: [Zabbix server]
Aug 23 20:57:55 l8dpa223ad1.domain zabbix_agent2[2456]: Press Ctrl+C to exit.
[root@l8dpa223ad1 ~]#
[root@l8dpa223ad1 ~]# systemctl enable zabbix-agent2
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service → /usr/lib/systemd/system/zabbix-agent2.service.
[root@l8dpa223ad1 ~]#
[root@l8dpa223ad1 ~]#
Zabbix ServerのWebインタフェースで、監視対象ホストを登録します("Create Host")。
監視対象ホストにOracle Instant Clientをインストールします。
[root@l8dpa223ad1 ~]# wget https://download.oracle.com/otn_software/linux/instantclient/1916000/oracle-instantclient19.16-basic-19.16.0.0.0-1.x86_64.rpm
--2022-08-23 21:02:52-- https://download.oracle.com/otn_software/linux/instantclient/1916000/oracle-instantclient19.16-basic-19.16.0.0.0-1.x86_64.rpm
Resolving download.oracle.com (download.oracle.com)... 104.115.164.102
Connecting to download.oracle.com (download.oracle.com)|104.115.164.102|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 53459024 (51M) [application/x-redhat-package-manager]
Saving to: ‘oracle-instantclient19.16-basic-19.16.0.0.0-1.x86_64.rpm’
oracle-instantclient19.16-basic-1 100%[============================================================>] 50.98M 11.0MB/s in 4.6s
2022-08-23 21:02:58 (11.0 MB/s) - ‘oracle-instantclient19.16-basic-19.16.0.0.0-1.x86_64.rpm’ saved [53459024/53459024]
[root@l8dpa223ad1 ~]# rpm -ivh oracle-instantclient19.16-basic-19.16.0.0.0-1.x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:oracle-instantclient19.16-basic-1################################# [100%]
監視対象のOracleデータベースに、Zabbix監視接続用のOracleユーザーを作成します。
Oracleユーザーに付与すべき権限についてのマニュアルの記載はおそらく正しくないです。 SELECT ANY DICTIONARY権限を付与することをお勧めします。
CREATE USER zabbix_mon IDENTIFIED BY zabbix_mon;
GRANT CONNECT, CREATE SESSION TO zabbix_mon;
GRANT SELECT ANY DICTIONARY TO zabbix_mon ;
の記載に従い、Zabbix-agent2.serviceのLimitNOFILEを65536にします。 これは状況によっては不要かもしれません。
[oracle@l8dpa223ad1 ~]$ sudo mkdir /etc/systemd/system/zabbix-agent2.service.d
[oracle@l8dpa223ad1 ~]$ sudo vi /etc/systemd/system/zabbix-agent2.service.d/limit.conf
[oracle@l8dpa223ad1 ~]$ cat /etc/systemd/system/zabbix-agent2.service.d/limit.conf
[Service]
LimitNOFILE=65536
[oracle@l8dpa223ad1 ~]$ sudo systemctl daemon-reload
[oracle@l8dpa223ad1 ~]$ sudo systemctl restart zabbix-agent2
Zabbix ServerのWebインタフェースで、 監視対象ホストへテンプレート "Oracle by Zabbix agent 2" をリンクします。
Zabbix ServerのWebインタフェースで、監視対象ホストのユーザーマクロとして、ホスト固有の情報を設定します。
具体的には、以下のユーザーマクロを設定します。
上記の作業が完了すると、Oracle by Zabbix agent 2 (Agent 2)から監視対象のOracleデータベースに 接続可能になり、アイテムの監視データが収集されます。
収集された監視データはグラフとして表示できます。
併せて、ディスカバリアイテムが実行され、アイテムが自動的に作成されます。
Oracle by Zabbix agent 2 にはLLD(ローレベルディスカバリ)が実装されており、 以下のディスカバリアイテムがデータベースの構造に応じてアイテムを自動的に作成できます。
ZabbixのOracle監視方式 全5種類
コーソルでは、データベース運用を製品とサービスでご支援します。
Database Performance Analyzer (DPA)は、オンプレミスとクラウド上の多くのデータベース製品に対応したデータベース性能管理製品です。低価格であるため、非常に導入しやすいです。
Zabbixの苦手なデータベース性能監視を補うことができます。
Database Performance Analyzer (DPA)
リモートDBAサービスはDB・運用の専門家がお客様のデータベースに対して 必要な時に必要な対応を行うリモート接続型運用保守サービスです。
リモートDBAサービス
時間制コンサルティングサービスは”必要な時に” ”必要な時間だけ”契約できる 時間契約型のコンサルティングサービスです。
時間制コンサルティングサービス