help - using the Oracle_Query

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: help - using the Oracle_Query

Post 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.
Former Nagios employee
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: help - using the Oracle_Query

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
asytechacd
Posts: 10
Joined: Tue Sep 15, 2015 2:21 am

Re: help - using the Oracle_Query

Post 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
asytechacd
Posts: 10
Joined: Tue Sep 15, 2015 2:21 am

Re: help - using the Oracle_Query

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: help - using the Oracle_Query

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
asytechacd
Posts: 10
Joined: Tue Sep 15, 2015 2:21 am

Re: help - using the Oracle_Query

Post 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 !
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: help - using the Oracle_Query

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
asytechacd
Posts: 10
Joined: Tue Sep 15, 2015 2:21 am

Re: help - using the Oracle_Query

Post 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)
Locked