Let me write a small HOW-TO for checking your Oracle Database without using the
tnsnames.ora file
This is written thanks to the help of my good friend EricTRA.
He provided me helpfull links and helped me for getting the solution.
This being said, here is the link which guided me :
Helpfull Link !!
So, I'm going to write this HOW-TO regarding the link and a plugin for Nagios and if you have an Oracle Database, this is the place you want to be.
With Nagios comes a server which we call a MONITORING SERVER. On this server Nagios is installed.
If you got that, you need to download certain zip-files to your monitoring server from the Oracle website
Link to instantclients that you'll need
But be aware, be sure what kind of OS you have (32-64 bit) because there a lot to choose from.
When you know the specific OS that you use, choose the most relevant of the link provided.
Then download the following:
- instantclient-basic-linux
- instantclient-sdk-linux
- instantclient-sqlplus-linux
It doesn't really matter what version you download, but preferable the newest (stable) version.
When you've downloaded that, you have to unzip them. I've selected them at the same time and the unzipped them. Eventually you need to get 1 folder, named:
instantclient_
version/
If you got that folder, please do the following commands:
Code:
sudo cp instantclient_version/sdk/include/*.h /usr/include
sudo cp instantclient_version/sqlplus /usr/bin
sudo cp instantclient_version/*.so* /usr/lib
Now, if this has been successfull, it's time to test some things. You'll see in the link i've followed he copies a file. But because I didn't had access to that specific file, I had to do it on a different way. Here is how i did it.
I've used following command:
Code:
sqlplus user/pass@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=sid)))'
Explaination:
- user : the name of the user which must log on
- pass : the password of that user
- host : the hostname of the host where your database is located on
- PORT : default 1521, but can be changed if needed
- sid : the SID of your database (System ID)
When you've used this command (please check your '(' and ')' ) it should work and you probably get something like:
Code:
SQL*Plus: Release 11.2.0.2.0 Production on Thu May 5 07:49:12 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options
SQL>
If you get something like that, you'll be fine.
Now when this is working and you want to put this in a plugin for Nagios.
My good friend EricTRA has provided me a very usefull plugin he had written and actually I only needed to change one thing
Code:
queryresult=`$sqlplus USER/PASS@TNSNAME <<EOF
command;
EOF`
TO
Code:
queryresult=`$sqlplus user/pass@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521)))(CONNECT_DATA=(SID=sid)))' << EOF
select *;
EOF`
So it's not a major thing
when you test and run it, you should be fine !!
When you have questions about this, feel free to post me a PM
!!
I was glad EricTRA have helped me once more and hopefully someday this will be helpfull for someone else !!
Kind regards
Brownie