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/

Nagios migration to a new Linux server


Here we are going to see the steps to migrate the nagios core from one linux server to another with different architecture.

While transferring all of the existing data, defined hosts, services, email alert scripts and Pnp4nagios data.

Step 1: Build the NEW server

Install fresh CentOS linux on a new server and configure the essential daemons (ssh/network).

Step 2: Install Nagios

After completing the linux installation, we need to install Nagios Core 3.5.1 in new server with necessary configuration.

Once Nagios setup completed, please make sure the dameons are running and able to open it up in web browser.

Step 3: Transfer configuration files

For example, the new server hostname/IPAddress is testserver/192.168.1.10

[root@server.local ~]# scp /usr/local/nagios/etc/*.cfg testserver:/usr/local/nagios/etc/

[root@server.local ~]# scp /usr/local/nagios/etc/objects/*.cfg testserver:/usr/local/nagios/etc/objects/

[root@server.local ~]# scp /etc/httpd/conf.d/nagios.conf testserver:/etc/httpd/conf.d/

Step 4: Check Nagios configuration

Run the below command to check whether newly migrated nagios server is working fine.

[root@testserver ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If you see 0 warnings and 0 errors then we are good on this migration.

Total Warnings: 0
Total Errors: 0

Step 5: Pnp4nagios migration

Please check my previous post to migrate the pnp4nagios from one linux server to another.

Great day, Thanks 🙂