How to monitor Oracle Database through nagios

Oracle

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.

[[email protected] ~]# 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

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

[[email protected] ~]# check_oracle_health-1.7.6.1.tar.gz

[[email protected] ~]# tar xvf check_oracle_health-1.7.6.1.tar.gz

[[email protected] ~]# cd check_oracle_health-1.7.6.1

[[email protected] ~]# ./configure

[[email protected] ~]# make

[[email protected] ~]# 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: