help on check_oracle_health getting an UNKNOWN

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
yescobar01
Posts: 30
Joined: Wed May 01, 2013 11:41 am

help on check_oracle_health getting an UNKNOWN

Post 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]#
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: help on check_oracle_health getting an UNKNOWN

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
yescobar01
Posts: 30
Joined: Wed May 01, 2013 11:41 am

Re: help on check_oracle_health getting an UNKNOWN

Post by yescobar01 »

I am letting it run via normal achedule here is the screenshot.
query vsession.png
You do not have the required permissions to view the files attached to this post.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: help on check_oracle_health getting an UNKNOWN

Post by abrist »

What version of XI are you using?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
yescobar01
Posts: 30
Joined: Wed May 01, 2013 11:41 am

Re: help on check_oracle_health getting an UNKNOWN

Post by yescobar01 »

Nagios XI 2012R1.8 Copyright © 2008-2013 Nagios Enterprises, LLC.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: help on check_oracle_health getting an UNKNOWN

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
yescobar01
Posts: 30
Joined: Wed May 01, 2013 11:41 am

Re: help on check_oracle_health getting an UNKNOWN

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: help on check_oracle_health getting an UNKNOWN

Post by abrist »

That is ugly, But it works! We will have to look at that plugin as that much escaping is just silly. Cheers!
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked