check_oracle_health SQL query

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
biswajit.banerjee
Posts: 152
Joined: Fri Dec 08, 2017 10:24 pm

check_oracle_health SQL query

Post by biswajit.banerjee »

In Check_oracle_health how can I convert following in sql query

select * from
(
select
opname,
start_time,
target,
sofar,
totalwork,
units,
elapsed_seconds,
message
from
v$session_longops
order by start_time desc
)
where rownum <=1;


I am not able to convert it make it work . Getting unknown issue .

Please help
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_oracle_health SQL query

Post by tgriep »

The issue is probably caused by the $ in the query so use the following example that escapes the $ in the query for the --name option.

Code: Select all

"select * from(select opname, start_time, target, sofar, totalwork, units, elapsed_seconds, message from v$"$"session_longops order by start_time desc) where rownum <=1;"
Be sure to check out our Knowledgebase for helpful articles and solutions!
biswajit.banerjee
Posts: 152
Joined: Fri Dec 08, 2017 10:24 pm

Re: check_oracle_health SQL query

Post by biswajit.banerjee »

No It is not working
. /usr/local/nagiosxi/etc/configwizards/oracle/oracle && /usr/local/nagios/libexec/check_oracle_health --connect '172.17.148.178:1521/AWSPROD' --username 'sys' --password 'sys' --mode sql --name="select * from(select opname, start_time, target, sofar, totalwork, units, elapsed_seconds, message from v$"$"session_longops order by start_time desc) where rownum <=1;"

UNKNOWN - got no valid response for select * from(select opname, start_time, target, sofar, totalwork, units, elapsed_seconds, message from v$session_longops order by start_time desc) where rownum <=1; - ORA-00933: SQL command not properly ended (DBD ERROR: error possibly near <*> indicator at char 164 in 'select * from(select opname, start_time, target, sofar, totalwork, units, elapsed_seconds, message from v$session_longops order by start_time desc) where rownum <=1<*>;')
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: check_oracle_health SQL query

Post by mbellerue »

Based on the message returned, it looks like it was passed to Oracle properly, but Oracle doesn't like the query for some reason. It says it isn't terminated properly, but it looks proper to me. If you copy and paste the query as it is shown in the check result, does it run in Oracle?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
biswajit.banerjee
Posts: 152
Joined: Fri Dec 08, 2017 10:24 pm

Re: check_oracle_health SQL query

Post by biswajit.banerjee »

Yes run on Oracle
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: check_oracle_health SQL query

Post by mbellerue »

Would it be possible to trace the query in Oracle when the plugin executes it? We're getting an Oracle error back, which means the plugin is connecting, authenticating, and getting as far as actually running the query.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked