Three Oracle db status need to be monitor ...

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Three Oracle db status need to be monitor ...

Post by xpertech »

Can NagiosXI monitor these three Oracle db status?

Our customer use PRTG to monitor these three status, and ask if their NagiosXI 2012 can monitor, too?

-----
[Total Sessions]
select count(*) from v$session;

-----
[Blocking Process]
SELECT count(*) FROM gv$session a, gv$instance b WHERE a.inst_id = b.inst_id AND a.blocking_session IS NOT NULL ORDER BY a.blocking_session;

-----
[Blocking Sessions]
select count(*) from Gv$session where blocking_session is not NULL order by blocking_session;
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Three Oracle db status need to be monitor ...

Post by sreinhardt »

Provided these return a single integer, yes this is absolutely possible. The oracle query wizard should be able to walk you through this.
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.
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Re: Three Oracle db status need to be monitor ...

Post by xpertech »

In Oracle local host, can directly use command: select count(*) from v$session

But if use "oracle query wizard" to monitor, there will be error, see attachment error1.jpg and error2.jpg:

command 1:
check_xi_oraclequery!-connect 172.17.1.99:1521 --username system --password "password" --mode sql --name="select count(*) from v$session" --warning 10000 --critical 13000

command 2:
check_xi_oraclequery! --connect "(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.1.99)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = mvf)))" --username system -- ​​password "​ ​password​" --mode sql --name="select count(*) from v$session" --warning 10000 --critical 13000


I wonder if anything wrong?

.
You do not have the required permissions to view the files attached to this post.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Three Oracle db status need to be monitor ...

Post by sreinhardt »

Based on the second error, it seems that your tns names file is not complete. This is something you should work with your oracle DBA on. As for the first error, it seems that the connection made, states that this table does not exist, is a current session only table that gets created?
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.
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Re: Three Oracle db status need to be monitor ...

Post by xpertech »

I installed Oracle 11g (11.2.0.1) on a computer for testing, db name is test01, ip is 192.168.1.107

when using MyOra tools to connect Oracle, the command return successful, meaning that syntax is fine.
select count(*) from v$session where status = 'ACTIVE'

but when SSH to NagiosXI using check_oracle_health, it failed, the error message indicate Oracle install_driver failed. don't know what could be the problem?

by the way, the NagiosXI wizard-Oracle Query is based on check_oracle_health, but the syntax of check_oracle_health seems wrong :
./check_oracle_health --connect 192.168.1.107:1521 --username system --password Passw0rd --mode sql --name="select count(*) from v/$session where status = "active" " --warning 3000 --critical 5000

it seems should be :

./check_oracle_health --connect 192.168.1.107:1521/test01 --username system --password Passw0rd --mode sql --name="select count(*) from v$session where status = 'ACTIVE' " --warning 3000 --critical 5000

.
You do not have the required permissions to view the files attached to this post.
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Re: Three Oracle db status need to be monitor ...

Post by xpertech »

Our customer said they use PRTG and same command can output data, but NagiosXi didn't.
We use Oracle system account on NagiosXI script to collect data but no output.
I refer http://support.nagios.com/forum/viewtop ... 3&start=30 , but have no idea how to setup NagiosXI environment?!
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: Three Oracle db status need to be monitor ...

Post by abrist »

Try doubling your '$' in v$session:

Code: Select all

v$$session
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.
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Re: Three Oracle db status need to be monitor ...

Post by xpertech »

abrist wrote:Try doubling your '$' in v$session:

Code: Select all

v$$session
still error!!
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: Three Oracle db status need to be monitor ...

Post by abrist »

Alright. Try using the resource.cfg file. Edit

Code: Select all

:
/usr/local/nagios/etc/resource.cfg
Add in a macro, we will use $USER9$ for this example.

Code: Select all

$USER9$=v$session
Save out.
Now change your check to reference $USER9$:

Code: Select all

./check_oracle_health --connect 192.168.1.107:1521/test01 --username system --password Passw0rd --mode sql --name="select count(*) from $USER9$ where status = 'ACTIVE' " --warning 3000 --critical 5000
Restart nagios and check it.
You may want to load the whole query from the resource.cfg file:

Code: Select all

$USER9$=sql --name="select count(*) from v$session where status = 'ACTIVE' "
And then make the check:

Code: Select all

./check_oracle_health --connect 192.168.1.107:1521/test01 --username system --password Passw0rd --mode $USER9$ --warning 3000 --critical 5000
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.
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Re: Three Oracle db status need to be monitor ...

Post by xpertech »

abrist wrote:Alright. Try using the resource.cfg file. Edit

Code: Select all

:
/usr/local/nagios/etc/resource.cfg
Add in a macro, we will use $USER9$ for this example.

Code: Select all

$USER9$=v$session
Save out.
Now change your check to reference $USER9$:

Code: Select all

./check_oracle_health --connect 192.168.1.107:1521/test01 --username system --password Passw0rd --mode sql --name="select count(*) from $USER9$ where status = 'ACTIVE' " --warning 3000 --critical 5000
still error! :?:

Restart nagios and check it.
You may want to load the whole query from the resource.cfg file:

Code: Select all

$USER9$=sql --name="select count(*) from v$session where status = 'ACTIVE' "
how to load that? :?:

And then make the check:

Code: Select all

./check_oracle_health --connect 192.168.1.107:1521/test01 --username system --password Passw0rd --mode $USER9$ --warning 3000 --critical 5000
still error! :?:
You do not have the required permissions to view the files attached to this post.
Locked