Page 1 of 1

help on check_oracle_health getting an UNKNOWN

Posted: Wed May 15, 2013 3:47 pm
by yescobar01
Hello All,

I am receiving an unknown error in my Nagios XI GUI when I try to query my oracle database, but when i enter the command in the command line it works. Can you tell me why it doesn't work in the GUI but works in the commandline.

This is the unknown error below:
UNKNOWN - got no valid response for select count(*) from v where status = &apos;ACTIVE&apos; - ORA-04044: procedure, function, package, or type is not allowed here (DBD ERROR: error possibly near <*> indicator at char 21 in &apos;select count(*) from <*>v where status


This is what i have in my $ARG1$ in the service management.

Code: Select all

-connect "64.143.xxx.xxx:1522/cdtbd6.db.att.com" --username usr --password "pwd" --mode sql --name="select count(*) from v\$session where status = 'ACTIVE' " --warning 50 --critical 200
When i test it in the command line it works fine and I am using the exact command in the command line as i did i had in my $ARG1$

Code: Select all

[root@oravm2 libexec]#  ./check_oracle_health -connect 64.143.xxx.xxx:1522/cdtbd2 --username usr --password "pwd" --mode sql --name="select count(*) from v\$session where status = 'ACTIVE'" --warning 50 --critical 200
OK - select count(*) from v$session where status = 'active': 22 | 'select'=22;50;200
[root@oravm2 libexec]#

Re: help on check_oracle_health getting an UNKNOWN

Posted: Wed May 15, 2013 3:50 pm
by sreinhardt
Are you using the test command button or letting it run via the normal scheduler? The test command option will strip out certain characters to avoid issues with php, where as defining a service and letting the scheduler run should not.

Re: help on check_oracle_health getting an UNKNOWN

Posted: Wed May 15, 2013 4:12 pm
by yescobar01
I am letting it run via normal achedule here is the screenshot.
query vsession.png

Re: help on check_oracle_health getting an UNKNOWN

Posted: Wed May 15, 2013 4:26 pm
by abrist
What version of XI are you using?

Re: help on check_oracle_health getting an UNKNOWN

Posted: Wed May 15, 2013 4:30 pm
by yescobar01
Nagios XI 2012R1.8 Copyright © 2008-2013 Nagios Enterprises, LLC.

Re: help on check_oracle_health getting an UNKNOWN

Posted: Wed May 15, 2013 4:42 pm
by abrist
Judging form this portion of your error ( &apos;ACTIVE&apos; ), I would assume you have an escaping issue. You may want to try eliminating the single quotes altogether or escaping them with a backslash ( \ ):

Code: Select all

-connect "64.143.xxx.xxx:1522/cdtbd6.db.att.com" --username usr --password "pwd" --mode sql --name="select count(*) from v\$session where status = \'ACTIVE\' " --warning 50 --critical 200
Or:

Code: Select all

-connect "64.143.xxx.xxx:1522/cdtbd6.db.att.com" --username usr --password "pwd" --mode sql --name="select count(*) from v\$session where status = \\'ACTIVE\\' " --warning 50 --critical 200
Or:

Code: Select all

-connect "64.143.xxx.xxx:1522/cdtbd6.db.att.com" --username usr --password "pwd" --mode sql --name="select count(*) from v\$session where status = ACTIVE " --warning 50 --critical 200

Re: help on check_oracle_health getting an UNKNOWN

Posted: Thu May 16, 2013 8:48 am
by yescobar01
Apperently we needed to add all these escapes in order for the query to work!! finally it works!

Code: Select all

-connect "64.143.xxx.xxx:1522/cdtbd6.db.att.com" --username usr --password "pwd" --mode sql --name="select%20count%28%2A%29%20from%20v%24session%20where%20status%20%3D%20%27ACTIVE%27" --warning 50 --critical 200

Re: help on check_oracle_health getting an UNKNOWN

Posted: Thu May 16, 2013 10:59 am
by abrist
That is ugly, But it works! We will have to look at that plugin as that much escaping is just silly. Cheers!