Page 3 of 3

Re: help - using the Oracle_Query

Posted: Tue Sep 29, 2015 1:44 pm
by tmcdonald
Go to the service in the CCM and copy out the contents of the ARG1 contents, ARG2, however many there are and post them here.

Re: help - using the Oracle_Query

Posted: Tue Sep 29, 2015 1:46 pm
by scottwilkerson
I believe this wiki entry is relevant in escaping the $ in your command

https://support.nagios.com/wiki/index.p ... ck_Command

I believe you may need to change your ARG1 to

Code: Select all

-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

Re: help - using the Oracle_Query

Posted: Tue Sep 29, 2015 11:18 pm
by asytechacd
tmcdonald wrote:Go to the service in the CCM and copy out the contents of the ARG1 contents, ARG2, however many there are and post them here.
Hi tcmdonald,

The contents in ARG1 is the same i posted yesterday which I am posting again below:

-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

As for ARG2, I do not have anything in it. I mean no arguments in that field.

Thanks
asytechacd

Re: help - using the Oracle_Query

Posted: Tue Sep 29, 2015 11:28 pm
by asytechacd
scottwilkerson wrote:I believe this wiki entry is relevant in escaping the $ in your command

https://support.nagios.com/wiki/index.p ... ck_Command

I believe you may need to change your ARG1 to

Code: Select all

-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
Hi scottwilkerson,

I changed the ARG1 according to what you suggested and it brought the same error.

COMMAND: /usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib ORACLE_HOME=/usr/lib/oracle/11.2/client64 /usr/local/nagios/libexec/check_oracle_health -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
OUTPUT: UNKNOWN - got no valid response for select count\(\*\) from v\\$$archived_log where applied=\'NO\' - ORA-00911: invalid character (DBD ERROR: error possibly near <*> indicator at char 12 in 'select count<*>\(\*\) from v\\$$archived_log where applied=\'NO\'')

If you follow-up on the postings I made, by running what I have in ARG1 from the command line is fine, but when saved in Nagios as an Oracle query service Or using the Test Command, it does not work.

Re: help - using the Oracle_Query

Posted: Wed Sep 30, 2015 1:12 pm
by lmiltchev
Using the "Test" command from within the CCM is not a 100% reliable. It may fail because of escaping issues. It is placed in the CCM for convenience and it is not a substitute for testing from the command line.
Try modifying the service by going to Home->Service Detail->Configure->Re-configure this service. Examine the command on this page and make sure it is the same as the "working" one (the one you tested from the CLI). Click on "Update" and schedule a forced immediate check. See if this is going to fix your issue.

Re: help - using the Oracle_Query

Posted: Sat Oct 03, 2015 6:47 am
by asytechacd
lmiltchev wrote:Using the "Test" command from within the CCM is not a 100% reliable. It may fail because of escaping issues. It is placed in the CCM for convenience and it is not a substitute for testing from the command line.
Try modifying the service by going to Home->Service Detail->Configure->Re-configure this service. Examine the command on this page and make sure it is the same as the "working" one (the one you tested from the CLI). Click on "Update" and schedule a forced immediate check. See if this is going to fix your issue.
Hi lmiltchev,

I modified the service as suggested in Home->Service Detail->Configure->Re-configure this service.

This time the result shows something different. Kindly see the message below:
------------
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'')
------------

Now this is after applying the working version on the CLI as shown below:
---------------
-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
---------------

From the error I got, Nagios does not seem to recognize the table/view properly and returns letter "v" instead of "v$archived_log".

So, If there is another way from Nagios can recognize the table/view from the query, your suggestion will be highly appreciated !

Re: help - using the Oracle_Query

Posted: Mon Oct 05, 2015 4:51 pm
by tgriep
Try changing the argument to the following and see if it works for you.

Code: Select all

-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

Re: help - using the Oracle_Query

Posted: Tue Oct 06, 2015 1:24 am
by asytechacd
tgriep wrote:Try changing the argument to the following and see if it works for you.

Code: Select all

-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
Hi tgriep,

At long last ! :D

Your suggestion worked well and as expected. So in the operations point of view, if the argument is applied it is fine. The Test Command should not be used if one wants to test, but we have to let Nagios do the job internally once the argument is configured.

So, if there is a way you can mark it as SOLVED and CLOSED, please proceed.

For this I say many thanks and we can at least say a solution is found on the subject.

Many appreciations

asytechacd :D
(Geoffrey)