How to monitor Oracle Database through nagios


check_oracle_health is a plugin to check various parameters of an Oracle database. This perl plugin has to be installing it on running oracle linux server.

Following steps will guide you to install some prerequisites perl packages.

[root@linux01 ~]# perl -MCPAN -e shell
cpan shell -- CPAN exploration and modules installation (v2.05)
Enter 'h' for help.

cpan[1]> install DBI

cpan[2]> install DBD::Oracle

cpan[3]> install Bundle::CPAN

Download and install monitoring plugin

[root@linux01 ~]# cd /tmp && wget http://labs.consol.de/download/shinken-nagios-plugins/check_oracle_health-1.7.6.1.tar.gz

[root@linux01 ~]# check_oracle_health-1.7.6.1.tar.gz

[root@linux01 ~]# tar xvf check_oracle_health-1.7.6.1.tar.gz

[root@linux01 ~]# cd check_oracle_health-1.7.6.1

[root@linux01 ~]# ./configure

[root@linux01 ~]# make

[root@linux01 ~]# make install

Preparation of the database

In order to be able to collect the needed information from the database a database user with specific privileges is required:

CREATE USER nagios IDENTIFIED BY oradbmon;
GRANT CREATE SESSION TO nagios;
GRANT SELECT any dictionary TO nagios;
GRANT SELECT ON V_$SYSSTAT TO nagios;
GRANT SELECT ON V_$INSTANCE TO nagios;
GRANT SELECT ON V_$LOG TO nagios;
GRANT SELECT ON SYS.DBA_DATA_FILES TO nagios;
GRANT SELECT ON SYS.DBA_FREE_SPACE TO nagios;


— if somebody still uses Oracle 8.1.7…

GRANT SELECT ON sys.dba_tablespaces TO nagios;
GRANT SELECT ON dba_temp_files TO nagios;
GRANT SELECT ON sys.v_$Temp_extent_pool TO nagios;
GRANT SELECT ON sys.v_$TEMP_SPACE_HEADER TO nagios;
GRANT SELECT ON sys.v_$session TO nagios;

Examples

nagios$ check_oracle_health --connect bba --mode tnsping
OK - connection established to bba.

nagios$ check_oracle_health --mode connection-time
OK - 0.17 seconds to connect |
connection_time=0.1740;1;5

nagios$ check_oracle_health --mode sga-data-buffer-hit-ratio
CRITICAL - SGA data buffer hit ratio 0.99% |
sga_data_buffer_hit_ratio=0.99%;98:;95:

For more details please visit the below link.

http://labs.consol.de/lang/en/nagios/check_oracle_health/