1、下载check_oracle_health,从下载源文件。
#tar -zxvf check_oracle_health-1.6.3.tar.gz #cd check_oracle_health-1.6.3#./configure --prefix=/opt/amstar/nagios --with-nagios-user=amstar --with-nagios-group=amstar --with-mymodules-dir=/opt/amstar/nagios/libexec --with-mymodules-dyn-dir=/opt/amstar/nagios/libexec#make all#make install#cd /opt/amstar/nagios/libexec/#./check_oracle_health -h查看一下使用语法Copyright (c) 2008 Gerhard LausserCheck various parameters of Oracle databases Usage:check_oracle_health [-v] [-t <timeout>] --connect=<connect string>--username=<username> --password=<password> --mode=<mode>--tablespace=<tablespace>check_oracle_health [-h | --help]check_oracle_health [-V | --version]Options:--connectthe connect string--usernamethe oracle user--passwordthe oracle user's password--warningthe warning range--criticalthe critical range--modethe mode of the plugin. select one of the following keywords:tnsping (Check the reachability of the server)connection-time (Time to connect to the server)connected-users (Number of currently connected users)sga-data-buffer-hit-ratio (Data Buffer Cache Hit Ratio)sga-library-cache-hit-ratio (Library Cache Hit Ratio)sga-dictionary-cache-hit-ratio (Dictionary Cache Hit Ratio)sga-latches-hit-ratio (Latches Hit Ratio)sga-shared-pool-reload-ratio (Shared Pool Reloads vs. Pins)sga-shared-pool-free (Shared Pool Free Memory)pga-in-memory-sort-ratio (PGA in-memory sort ratio)invalid-objects (Number of invalid objects in database)stale-statistics (Find objects with stale optimizer statistics)tablespace-usage (Used space in tablespaces)tablespace-free (Free space in tablespaces)tablespace-remaining-time (Remaining time until a tablespace is full)tablespace-fragmentation (Free space fragmentation index)tablespace-io-balance (balanced io of all datafiles)tablespace-can-allocate-next (Segments (of a tablespace) can allocate next extent)datafile-io-traffic (io operations/per sec of a datafile)soft-parse-ratio (Percentage of soft parses)switch-interval (Time between redo log file switches)retry-ratio (Redo buffer allocation retries)redo-io-traffic (Redo log io bytes per second)roll-header-contention (Rollback segment header contention)roll-block-contention (Rollback segment block contention)roll-hit-ratio (Rollback segment hit ratio (gets/waits))roll-wraps (Rollback segment wraps (per sec))roll-extends (Rollback segment extends (per sec))roll-avgactivesize (Rollback segment average active size)seg-top10-logical-reads (user objects among top 10 logical reads)seg-top10-physical-reads (user objects among top 10 physical reads)seg-top10-buffer-busy-waits (user objects among top 10 buffer busy waits)seg-top10-row-lock-waits (user objects among top 10 row lock waits)event-waits (processes wait events)event-waiting (time spent by processes waiting for an event)enqueue-contention (percentage of enqueue requests which must wait)enqueue-waiting (percentage of time spent waiting for the enqueue)latch-contention (percentage of latch get requests which must wait)latch-waiting (percentage of time a latch spends sleeping)sysstat (change of sysstat values over time)sql (any sql command returning a single number)list-tablespaces (convenience function which lists all tablespaces)list-datafiles (convenience function which lists all datafiles)list-enqueues (convenience function which lists all enqueues)list-latches (convenience function which lists all latches)list-events (convenience function which lists all events)list-background-events (convenience function which lists all background events)list-sysstats (convenience function which lists all statistics from v$sysstat)--namethe name of the tablespace, datafile, wait event, latch, enqueue, or sql statement depending on the mode.--name2if name is a sql statement, this statement would appear inthe output and the performance data. This can be ugly, so name2 can be used to appear instead.--regexpif this parameter is used, name will be interpreted as a regular expression.--unitsone of %, KB, MB, GB. This is used for a better output of mode=sqland for specifying thresholds for mode=tablespace-freeTablespace-related modes check all tablespaces in one run by default.If only a single tablespace should be checked, use the --name parameter.The same applies to datafile-related modes.tablespace-remaining-time will take historical data into account. The numberof days in the past can be given with the --lookback parameter. (Default: 30)In mode sql you can url-encode the statement so you will not have to messaround with special characters in your Nagios service definitions.Instead of --name="select count(*) from v$session where status = 'ACTIVE'"you can say --name=select%20count%28%2A%29%20from%20v%24session%20where%20status%20%3D%20%27ACTIVE%27For your convenience you can call check_oracle_health with the --encodeoption and it will encode the standard input.Send email to gerhard.lausser@consol.de if you have questionsregarding use of this software. Please include version information with all correspondence (when possible,use output from the --version option of the plugin itself).特别注意使用该插件需要先安装perl访问oracle的cpan,DBD::Oracle。安装方法:见几个示范命令行:查询表空间使用情况全部表空间#./check_oracle_health --connect=ismp --user=usr_ismp --password=111111--mode=tablespace-usage 指定表空间#./check_oracle_health --connect=ismp --user=usr_ismp --password=111111--mode=tablespace-usage --tablespace=TSP_ISMPtsnping:#./check_oracle_health --connect=ismp --user=usr_ismp --password=111111--mode=tnsping貌似这个插件很好很强大,可以替换掉自带check_oracle插件了。btw:如果执行命令提示:Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi就是缺少了HiRes.pm,下载安装就好了。#wget http://www.perl.com/CPAN/modules/by-module/Time/Time-HiRes-01.02.tar.gz#cd Time-HiRes-01.02#perl Makefile.PL#make all#make install