Page 2 of 3

Re: help - using the Oracle_Query

Posted: Wed Sep 16, 2015 5:06 pm
by tmcdonald
Have you tried running these from the command line? The Test Check Command button is notorious for escaping certain characters.

Re: help - using the Oracle_Query

Posted: Sat Sep 19, 2015 12:48 am
by asytechacd
tmcdonald wrote:Have you tried running these from the command line? The Test Check Command button is notorious for escaping certain characters.
Hi tmcdonald,

I tried to run as suggested through the command line. I tried one of the commands which I reported earlier which had reported errors and the result is much the same as in "invalid character ". Though this time it reports the ORA error (ORA-00904), different from the original ORA-00911. But both ORA errors are of the same nature, "character error based". Kindly see below:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TEST CASE 1
--
--(For the command - select count(applied) from select count(applied) from v\$archived_log where applied="NO" )
--

[root@RSRV libexec]# export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
[root@RSRV libexec]# export ORACLE_HOME=/usr/lib/oracle/11.2/client64
[root@RSRV libexec]# ./check_oracle_health -connect 10.10.9.8:1521/livedb --username system --password "manager" --mode sql --name="select count(applied) from v\$archived_log where applied="NO"" --warning 50 --critical 200
UNKNOWN - got no valid response for select count(applied) from v$archived_log where applied=NO - ORA-00904: "NO": invalid identifier (DBD ERROR: error possibly near <*> indicator at char 56 in 'select count(applied) from v$archived_log where applied=<*>NO')



TEST CASE 2
--
--(For the command - select count(*) from select count(applied) from v\$archived_log where applied="NO" )
--

[root@RSRV libexec]# ./check_oracle_health -connect 10.10.9.8:1521/livedb --username system --password "manager" --mode sql --name="select count(*) from v\$archived_log where applied="NO"" --warning 50 --critical 200
UNKNOWN - got no valid response for select count(*) from v$archived_log where applied=NO - ORA-00904: "NO": invalid identifier (DBD ERROR: error possibly near <*> indicator at char 50 in 'select count(*) from v$archived_log where applied=<*>NO')

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Your Tech Support will be highly appreciated !

Geoffrey
(asytechacd)

Re: help - using the Oracle_Query

Posted: Mon Sep 21, 2015 4:37 pm
by tmcdonald
asytechacd wrote:[root@RSRV libexec]# export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
[root@RSRV libexec]# export ORACLE_HOME=/usr/lib/oracle/11.2/client64
[root@RSRV libexec]# ./check_oracle_health -connect 10.10.9.8:1521/livedb --username system --password "manager" --mode sql --name="select count(applied) from v\$archived_log where applied="NO"" --warning 50 --critical 200
UNKNOWN - got no valid response for select count(applied) from v$archived_log where applied=NO - ORA-00904: "NO": invalid identifier (DBD ERROR: error possibly near <*> indicator at char 56 in 'select count(applied) from v$archived_log where applied=<*>NO')
You are mixing quotation marks improperly:

--name="select count(applied) from v\$archived_log where applied="NO""

should be

--name="select count(applied) from v\$archived_log where applied='NO'"

because your usage of only double quotes is "breaking out" the quotation.

And you are escaping the $ sign possibly improperly:

from v\$archived_log where

might need to be

from v$archived_log where

depending on the context in which this is run, but it is almost certainly not supposed to be escaped. Most likely it was a variable in some bash or PHP script that got copied and the $archived_log is a variable.

Re: help - using the Oracle_Query

Posted: Tue Sep 22, 2015 12:18 am
by asytechacd
tmcdonald wrote:
asytechacd wrote:[root@RSRV libexec]# export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
[root@RSRV libexec]# export ORACLE_HOME=/usr/lib/oracle/11.2/client64
[root@RSRV libexec]# ./check_oracle_health -connect 10.10.9.8:1521/livedb --username system --password "manager" --mode sql --name="select count(applied) from v\$archived_log where applied="NO"" --warning 50 --critical 200
UNKNOWN - got no valid response for select count(applied) from v$archived_log where applied=NO - ORA-00904: "NO": invalid identifier (DBD ERROR: error possibly near <*> indicator at char 56 in 'select count(applied) from v$archived_log where applied=<*>NO')
You are mixing quotation marks improperly:

--name="select count(applied) from v\$archived_log where applied="NO""

should be

--name="select count(applied) from v\$archived_log where applied='NO'"

because your usage of only double quotes is "breaking out" the quotation.

And you are escaping the $ sign possibly improperly:

from v\$archived_log where

might need to be

from v$archived_log where

depending on the context in which this is run, but it is almost certainly not supposed to be escaped. Most likely it was a variable in some bash or PHP script that got copied and the $archived_log is a variable.

Hi again,

I tested again as recommended.


TEST CASE 1 - After removing the '\' character, it failed to locate the view v$archived_log. Also the in this first test case I removed the double quotes and no error on that.


[root@RSRV libexec]# ./check_oracle_health -connect 10.10.9.8:1521/livedb --username system --password "manager" --mode sql --name="select count(*) from v$archived_log where applied='NO'" --warning 50 --critical 200
UNKNOWN - got no valid response for select count(*) from v where applied='NO' - ORA-00942: table or view does not exist (DBD ERROR: error possibly near <*> indicator at char 21 in 'select count(*) from <*>v where applied='NO'')



TEST CASE 2 - After restoring the '\' character, it finally worked. So the solution relies on maintaining the escape character PLUS applying single quotes in the condition as suggested.


[root@RSRV libexec]# ./check_oracle_health -connect 10.10.9.8:1521/livedb --username system --password "manager" --mode sql --name="select count(*) from v\$archived_log where applied='NO'" --warning 50 --critical 200
OK - select count(*) from v$archived_log where applied='no': 0 | 'select'=0;50;200


So on testing the query through the command line it works now. Though Nagios may still have to revisit the Test Command Button on the interface. I did the same changes in the settings and now I am monitoring the SMS/email notifications to see if this query error comes again.

Re: help - using the Oracle_Query

Posted: Tue Sep 22, 2015 4:49 pm
by tmcdonald
Glad to see it is working at least.

Yea, the Test Check Command button is somewhat flawed for reasons that aren't entirely under our control. For security reasons we need to strip out some characters, and PHP interprets things like th $ as language-specific control characters, so it's hard to make something run exactly in the web interface as it would on the command line.

Are we all set to close this thread? It sounds like it is working now but if you need to test for a bit we can leave it open until you can confirm.

Re: help - using the Oracle_Query

Posted: Wed Sep 23, 2015 6:26 am
by asytechacd
tmcdonald wrote:Glad to see it is working at least.

Yea, the Test Check Command button is somewhat flawed for reasons that aren't entirely under our control. For security reasons we need to strip out some characters, and PHP interprets things like th $ as language-specific control characters, so it's hard to make something run exactly in the web interface as it would on the command line.

Are we all set to close this thread? It sounds like it is working now but if you need to test for a bit we can leave it open until you can confirm.
Hi tmcdonald,

Good to hear from you again on the subject.

RESULTS AFTER MONITORING:
------------------------------------

1. After the successful test and change, I noticed that now the Sync Status f the service in the CCM now shows "Synced To File", where previously it showed "Not Syncronized"

2. Secondly, the alert message that I receive now says : " Service Alert on host: 10.10.9.8. Service state: UNKNOWN on service Oracle Query - Log Apply Status. Time Wed Sept 23 14:58:53 AFT 2015"
Well this status message as in "UNKNOWN" was also appearing when I initially reported the error. Now I do not know if it signifies that when Nagios is running the query automatically is using the same semantics/syntax as we have for the Test Command Button. Generally, if the status is fine it should report as status: OK or if not fine then a different message status should report back.

Maybe this might be another area we need to check whether the internal Nagios mechanism running the Oracle query is having the "character" issue. Then if we can prove that it means we confirm that at least the Oracle Query works and other issues may be resolved in future Nagios releases.

Otherwise I welcome your suggestions/recommendations/ideas about my observation.

Regards

Geoffrey
(asytechacd)

Re: help - using the Oracle_Query

Posted: Wed Sep 23, 2015 5:18 pm
by ssax
./check_oracle_health -connect 10.10.9.8:1521/livedb --username system --password 'manager' --mode sql --name='select count(*) from v$archived_log where applied="NO"' --warning 50 --critical 200

Try using the command above (mainly with the double quotes and single quotes changed around and without the \ before the dollary sign) and let us know if that works for you.

Re: help - using the Oracle_Query

Posted: Sun Sep 27, 2015 6:49 am
by asytechacd
ssax wrote:./check_oracle_health -connect 10.10.9.8:1521/livedb --username system --password 'manager' --mode sql --name='select count(*) from v$archived_log where applied="NO"' --warning 50 --critical 200

Try using the command above (mainly with the double quotes and single quotes changed around and without the \ before the dollary sign) and let us know if that works for you.
Hi ssax,

Running the test on the Linux Command line is fine, of which I reported earlier in one of my latest reply before the last.

I also tried your latest recommendation but it is still the same alert message saying "UKNOWN" and the whole message is shown below:

==================

Service Alert on host:10.10.9.8. Service state: UNKNOWN on service Oracle Query - Log Apply Status. Time Sun Sept 27 14:30:32 AFT
2015

==================

The Oracle Query service is not working by itself after completing the setting Nagio. And in this case I mean after applying the same command that run on the Linux command line successfully.

From the way I understood "tmcdonald", the Test Command of the service is the one which appears to have the bug and we assumed that once the command line test was ok, then the same could be applied on the Oracle Query service. But I got the same error with the "UNKNOWN" status as shown above.

Re: help - using the Oracle_Query

Posted: Mon Sep 28, 2015 11:24 am
by ssax
Please post your service configuration so that we can take a look at it.
- Go to Configure > Core Config Manager > Services and click the little blue floppy disk icon so that we can see the config details.

Thank you

Re: help - using the Oracle_Query

Posted: Mon Sep 28, 2015 11:03 pm
by asytechacd
ssax wrote:Please post your service configuration so that we can take a look at it.
- Go to Configure > Core Config Manager > Services and click the little blue floppy disk icon so that we can see the config details.

Thank you
Hello ssax,

Requested config details are shown below:

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date: 2015-09-29 08:25:33
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
host_name 10.10.9.8
service_description Oracle Query - Log Apply Status
use xiwizard_oraclequery_service
check_command check_xi_oraclequery!-connect 10.10.9.8:1521/asywdb --username system --password "manager" --mode sql --name="select count(*) from v\$archived_log where applied='NO'" --warning 50 --critical 200!!!!!!!
max_check_attempts 5
check_interval 60
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
_xiwizard oraclequery
register 1
}

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################