Page 1 of 2

Three Oracle db status need to be monitor ...

Posted: Thu Aug 29, 2013 9:40 am
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;

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

Posted: Thu Aug 29, 2013 9:44 am
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.

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

Posted: Fri Aug 30, 2013 4:26 am
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?

.

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

Posted: Fri Aug 30, 2013 10:30 am
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?

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

Posted: Sun Sep 01, 2013 10:33 am
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

.

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

Posted: Sun Sep 01, 2013 9:40 pm
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?!

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

Posted: Tue Sep 03, 2013 11:11 am
by abrist
Try doubling your '$' in v$session:

Code: Select all

v$$session

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

Posted: Tue Sep 03, 2013 11:43 am
by xpertech
abrist wrote:Try doubling your '$' in v$session:

Code: Select all

v$$session
still error!!

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

Posted: Tue Sep 03, 2013 1:08 pm
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

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

Posted: Wed Sep 04, 2013 6:45 pm
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! :?: