1. 程式人生 > >開源監控解決方案:ICINGA(Nagios)監控Oracle Database

開源監控解決方案:ICINGA(Nagios)監控Oracle Database

ima 方案 invalid spa block obj adapter tool esp

[root@king01 ~]# yum -y install perl-ExtUtils-MakeMaker perl-Time-HiRes [root@king01 ~]# tar zxvf DBI-1.637.tar.gz [root@king01 ~]# cd DBI-1.637 [root@king01 DBI-1.637]# perl Makefile.PL [root@king01 DBI-1.637]# make all [root@king01 DBI-1.637]# make install [root@king01 ~]# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 [root@king01 ~]# tar zxvf DBD-Oracle-1.74.tar.gz [root@king01 ~]# cd DBD-Oracle-1.74 [root@king01 DBD-Oracle-1.74]# perl Makefile.PL [root@king01 DBD-Oracle-1.74]# make all [root@king01 DBD-Oracle-1.74]# make install [root@king01 ~]# tar zxvf check_oracle_health-3.1.2.2.tar.gz [root@king01 ~]# cd check_oracle_health-3.1.2.2 [root@king01 check_oracle_health-3.1.2.2]# ./configure --prefix=/usr/local/icinga --with-nagios-user=icinga --with-nagios-group=icinga --with-mymodules-dir=/usr/local/icinga/libexec [root@king01 check_oracle_health--3.1.2.2]# make all [root@king01 check_oracle_health--3.1.2.2]# make install [root@king01 ~]# vi /etc/ld.so.conf /u01/app/oracle/product/11.2.0/db_1/lib [root@king01 ~]# ldconfig [root@king01 ~]# su - oracle [oracle@king01 ~]$ cd /u01/app/oracle/product/11.2.0/db_1/network/admin/ [oracle@king01 admin]$ vi tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. ZXMDB = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.202)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = king) ) ) [oracle@king01 ~]$ tnsping zxmdb TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 06-AUG-2018 14:00:26 Copyright (c) 1997, 2013, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.202)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = king))) OK (0 msec) [root@king01 ~]# cd /usr/local/icinga/libexec/ [root@king01 libexec]# vi check_oracle_health $ENV{"ORACLE_HOME"} = "/u01/app/oracle/product/11.2.0/db_1"; [root@king01 libexec]# ./check_oracle_health --connect=zxmdb --username=system --password=oracle --mode=tnsping OK - connection established to zxmdb. [root@king01 libexec]# ./check_oracle_health --connect=zxmdb --username=system --password=oracle --mode=connection-time OK - 0.06 seconds to connect as SYSTEM | connection_time=0.0598;1;5 [root@king01 ~]# cd /usr/local/icinga/etc/objects/ [root@king01 objects]# vi commands.cfg define command{ command_name check_oracle command_line $USER1$/check_oracle_health --connect=$ARG1$ --username=system --password=oracle --mode=$ARG2$ } [root@king01 objects]# vi oracle.cfg # define a host define host{ use linux-server host_name zxmdb alias zxmdb icon_image redhat.gif statusmap_image redhat.gd2 address 192.168.1.202 } # define an hostgroup define hostgroup{ hostgroup_name sales-database alias sales-database members zxmdb } # define an servicegroup define servicegroup { servicegroup_name ping alias ping } define servicegroup { servicegroup_name cpu alias cpu } define servicegroup { servicegroup_name memory alias memory } define servicegroup { servicegroup_name disk alias disk } define servicegroup { servicegroup_name network alias network } define servicegroup { servicegroup_name uptime alias uptime } define servicegroup { servicegroup_name oracle alias oracle } # Define a service define service{ hostgroup_name sales-database use generic-service service_description alive servicegroups ping check_command check_ping!100.0,20%!500.0,60% } define service{ hostgroup_name sales-database use generic-service service_description os cpu usage servicegroups cpu check_command check_nrpe!check_cpu } define service{ hostgroup_name sales-database use generic-service service_description os memory usage servicegroups memory check_command check_nrpe!check_memory } define service{ hostgroup_name sales-database use generic-service service_description os disk usage servicegroups disk check_command check_nrpe!check_disk } define service{ hostgroup_name sales-database use generic-service service_description os network usage servicegroups network check_command check_nrpe!check_network } define service{ hostgroup_name sales-database use generic-service service_description os uptime servicegroups uptime check_command check_nrpe!check_uptime } define service{ hostgroup_name sales-database use generic-service service_description oracle tnsping servicegroups oracle check_command check_oracle!zxmdb!tnsping } define service{ hostgroup_name sales-database use generic-service service_description oracle connection-time servicegroups oracle check_command check_oracle!zxmdb!connection-time } define service{ hostgroup_name sales-database use generic-service service_description oracle connected-users servicegroups oracle check_command check_oracle!zxmdb!connected-users } define service{ hostgroup_name sales-database use generic-service service_description oracle session-usage servicegroups oracle check_command check_oracle!zxmdb!session-usage } define service{ hostgroup_name sales-database use generic-service service_description oracle process-usage servicegroups oracle check_command check_oracle!zxmdb!process-usage } define service{ hostgroup_name sales-database use generic-service service_description oracle rman-backup-problems servicegroups oracle check_command check_oracle!zxmdb!rman-backup-problems } define service{ hostgroup_name sales-database use generic-service service_description oracle invalid-objects servicegroups oracle check_command check_oracle!zxmdb!invalid-objects } define service{ hostgroup_name sales-database use generic-service service_description oracle stale-statistics servicegroups oracle check_command check_oracle!zxmdb!stale-statistics } define service{ hostgroup_name sales-database use generic-service service_description oracle corrupted-blocks servicegroups oracle check_command check_oracle!zxmdb!corrupted-blocks } define service{ hostgroup_name sales-database use generic-service service_description oracle tablespace-usage servicegroups oracle check_command check_oracle!zxmdb!tablespace-usage } define service{ hostgroup_name sales-database use generic-service service_description oracle soft-parse-ratio servicegroups oracle check_command check_oracle!zxmdb!soft-parse-ratio } define service{ hostgroup_name sales-database use generic-service service_description oracle switch-interval servicegroups oracle check_command check_oracle!zxmdb!switch-interval } define service{ hostgroup_name sales-database use generic-service service_description oracle retry-ratio servicegroups oracle check_command check_oracle!zxmdb!retry-ratio } define service{ hostgroup_name sales-database use generic-service service_description oracle flash-recovery-area-usage servicegroups oracle check_command check_oracle!zxmdb!flash-recovery-area-usage } define service{ hostgroup_name sales-database use generic-service service_description oracle flash-recovery-area-free servicegroups oracle check_command check_oracle!zxmdb!flash-recovery-area-free } define service{ hostgroup_name sales-database use generic-service service_description oracle failed-jobs servicegroups oracle check_command check_oracle!zxmdb!failed-jobs } define service{ hostgroup_name sales-database use generic-service service_description oracle sga-data-buffer-hit-ratio servicegroups oracle check_command check_oracle!zxmdb!sga-data-buffer-hit-ratio } define service{ hostgroup_name sales-database use generic-service service_description oracle sga-library-cache-gethit-ratio servicegroups oracle check_command check_oracle!zxmdb!sga-library-cache-gethit-ratio } define service{ hostgroup_name sales-database use generic-service service_description oracle sga-library-cache-pinhit-ratio servicegroups oracle check_command check_oracle!zxmdb!sga-library-cache-pinhit-ratio } define service{ hostgroup_name sales-database use generic-service service_description oracle sga-library-cache-reloads servicegroups oracle check_command check_oracle!zxmdb!sga-library-cache-reloads } define service{ hostgroup_name sales-database use generic-service service_description oracle sga-dictionary-cache-hit-ratio servicegroups oracle check_command check_oracle!zxmdb!sga-dictionary-cache-hit-ratio } define service{ hostgroup_name sales-database use generic-service service_description oracle sga-dictionary-cache-hit-ratio servicegroups oracle check_command check_oracle!zxmdb!sga-dictionary-cache-hit-ratio } define service{ hostgroup_name sales-database use generic-service service_description oracle sga-latches-hit-ratio servicegroups oracle check_command check_oracle!zxmdb!sga-latches-hit-ratio } define service{ hostgroup_name sales-database use generic-service service_description oracle sga-shared-pool-reload-ratio servicegroups oracle check_command check_oracle!zxmdb!sga-shared-pool-reload-ratio } define service{ hostgroup_name sales-database use generic-service service_description oracle sga-shared-pool-free servicegroups oracle check_command check_oracle!zxmdb!sga-shared-pool-free } define service{ hostgroup_name sales-database use generic-service service_description oracle pga-in-memory-sort-ratio servicegroups oracle check_command check_oracle!zxmdb!pga-in-memory-sort-ratio }











開源監控解決方案:ICINGA(Nagios)監控Oracle Database