Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got an install of Nagios XI that doesn't seem to want to talk to any of my Oracle services here. I've pulled out the monitoring command and am running it manually, after setting ORACLE_HOME and LD_LIBDRARY_PATH of course, but it keeps generating the following error:

/usr/local/nagios # libexec/check_oracle_health --connect "oracle-server:1551" --username user --password "pass" --name OFFDB1 --mode tablespace-can-allocate-next --warning 20 --critical 30
CRITICAL - cannot connect to oracle-server:1551. ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA (DBD ERROR: OCIServerAttach)

I'm still fairly new to Oracle, but my googlings seem to indicate that SERVICE_NAME should match the GLOBAL_DBNAME in listener.ora, which is OFFDB1. Do I need to do something else here like modify the connect string?

As a note, there are multiple instances of oracle sharing the target box, but each seems to be intalled to separate partitions and are running their own listeners or various ports.

share|improve this question

migrated from Dec 10 '12 at 20:14

This question came from our site for system and network administrators.

Does libexec/check_oracle_health --connect=OFFDB1 --mode=tnsping work? If not, you need a correctly configured tnsnames.ora on the nagios box. – Phil Dec 11 '12 at 0:05
It doesn't seem like I have one at all, but I think I may have found one I can use. It is just supposed to live in $ORACLE_HOME? – Sammitch Dec 11 '12 at 16:26
$ORACLE_HOME/network/admin – Phil Dec 11 '12 at 18:35
The only folders I have in $ORACLE_HOME are bin and lib. I've created network/admin and copied tnsnames.ora from the database server, but now I just get a CRITICAL - cannot connect to OFFDB1. ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach). I'm getting the feeling that this network folder should have already existed. – Sammitch Dec 11 '12 at 19:03
If you are using Oracle Instant Client the default location of tnsnames.ora is /etc/tnsnames.ora, still in most cases you will get away with an EZConnect string as described in my answer below. – Roy Feb 26 '13 at 12:50

You should be able to use the newer EZConnect format: host:port/service:connection_type saving you the hassle of adding a TNS entry.

The connection_type and port are both optional and will default to dedicated and 1521 respectively.

Changing the connect parameter of your monitoring command as follows should do the trick:

--connect "oracle-server:1551/OFFDB1" 
share|improve this answer

As Phil mentioned, I created $ORACLE_HOME/network/admin and tnsnames.ora. I have something like this:

    (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = oracle-server)(PORT = 1551))

I then modified the monitoring commands:

/usr/local/nagios# libexec/check_oracle_health --connect=OFFDB1 --username user 
    --password "pass" --mode tablespace-can-allocate-next --warning 20 --critical 30
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.