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
check_oracle_health SQL query
Re: check_oracle_health SQL query
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
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<*>;')
. /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<*>;')
Re: check_oracle_health SQL query
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!
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
Yes run on Oracle
Re: check_oracle_health SQL query
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!
Be sure to check out our Knowledgebase for helpful articles and solutions!