Using Oracle’s preinstalled perl DBD::Oracle library
Oracle started bundle perl DBD::Oracle with their software from version 10g. I used to install DBD::Oracle on each machine that I monitor oracle database through nagios but I started using preinstalled one and this is how you can do it.
The DBD::Oracle is located under ORACLE_HOME/perl/lib/site_perl//DBD. So, I set following two environment to use pre-installed library.
|
export PERL5LIB=$ORACLE_HOME/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi:$PERL5LIB export PATH=$ORACLE_HOME/perl/bin:$PATH |
In addition to that we also need to use perl executable under ORACLE_HOME. So, it is recommended to change your existing script to use the perl under your environment variable instead of fixed /usr/bin/perl.
| #!/usr/bin/env perl |
Last, if you are using nrpe and want to check oracle database the you have to put below three environment variables in side nrpe(/etc/init.d/nrpe) auto start script.
|
export ORACLE_HOME=/home/app/oracle/product/11g export PERL5LIB=$ORACLE_HOME/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi:$PERL5LIB export PATH=$ORACLE_HOME/perl/bin:$PATH |
leave a comment