Help for implementing a check of an Oracle query

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
gio123bg
Posts: 2
Joined: Fri Mar 09, 2012 5:30 am

Help for implementing a check of an Oracle query

Post by gio123bg »

Hi All,
I'm a newbie in this forum and I have been trying to find a documentation for implementing a check of an Oracle query on Nagios environment.

The requirement is very simple.

This is the Oracle query

select count(*) from IM_BC_JOB;

If count_number >= 10 then RED alert
if count_number < 10 then GREEN alert

Any help or suggestion to customize Nagios step by step will be well appreciated.

Thanks in advance for your kind support.

Regards,

Giovanni
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Help for implementing a check of an Oracle query

Post by mguthrie »

I'll be moving this to the Nagios Core forum for better visibility.

Usually the community uses the following plugin for Oracle related checks, although I know there is some setup involved.
http://exchange.nagios.org/directory/Pl ... th/details
gio123bg
Posts: 2
Joined: Fri Mar 09, 2012 5:30 am

Re: Help for implementing a check of an Oracle query

Post by gio123bg »

Hi,
thanks again for your suggestion.

I have a Nagios environment already installed, I suppose with Oracle connection. I have find this link

http://exchange.nagios.org/directory/Da ... ry/details

where suggest me to use check_sql_query access_file query_file

Maybe this is the solution to run an "query_file" (korn shell with sql query) and return a value.

My problem at the moment is to find a suggestion about the configuration steps to follow for implementing this service.

Any help will be well appreciated in starting the configuration.

Thanks in advance for your kind support.

Regards,

Giovanni
gridd
Posts: 6
Joined: Sun Aug 19, 2012 8:38 pm

Re: Help for implementing a check of an Oracle query

Post by gridd »

I did something what you ask many years ago, so I cannot remember in details.
But the general idea is to use sqlplus - an Oracle tool for batch querying.
It runs sql script and returns data to standard output. there are lot of formatting options also, so you can fine tune your output data in almost any way.

example:

#create some script
cat <<EOF > local_script.sql
select count(*) from IM_BC_JOB;
EOF
#call sqlplus with script
sqlplus -s scott/tiger @local_script.sql > ora_results

#you may use awk,perl or any to parse returned Oracle table values
#and return proper values to nagios

try to find any book on Oracle scripting, some of them are availale on the net.

I'm not shure this code correct and could run, but I hope you will get an idea how to start.

gio123bg wrote:Hi,
thanks again for your suggestion.

I have a Nagios environment already installed, I suppose with Oracle connection. I have find this link

http://exchange.nagios.org/directory/Da ... ry/details

where suggest me to use check_sql_query access_file query_file

Maybe this is the solution to run an "query_file" (korn shell with sql query) and return a value.

My problem at the moment is to find a suggestion about the configuration steps to follow for implementing this service.

Any help will be well appreciated in starting the configuration.

Thanks in advance for your kind support.

Regards,

Giovanni
Locked