check_oracle plugin returns - CRITICAL- ORA-12154:TNS: count not resolve service name

Bret Goodfellow Bret.Goodfellow at questar.com
Wed Oct 11 22:43:35 CEST 2006


The user (nagios) is the id that is executing both ssh and check_by_ssh.
I did discover though, that when these commands are run, the
"environments" established for ssh and check_by_ssh are different.
 
Below is the environment established for ssh (THIS IS THE ONE THAT
WORKS!!):
 
SHELL=/bin/bash
SSH_CLIENT=10.8.24.170 58641 22
USER=nagios
LS_COLORS=
ORACLE_SID=ver_9206
ORACLE_BASE=/oracle
ORACLE_ADHOC=/oracle/local/adhoc
MAIL=/var/mail/nagios
PATH=/usr/bin:/bin:/usr/sbin:/sbin
TNS_ADMIN=/oracle/network/admin
PWD=/home/nagios
LANG=en_US.UTF-8
SQLPATH=/oracle/local/adhoc:%PATH
SHLVL=1
HOME=/home/nagios
LS_OPTIONS=-N --color=non -T O
LOGNAME=nagios
SSH_CONNECTION=10.8.24.170 58641 10.8.24.191 22
ORACLE_HOME=/oracle/product/9.2.0.6
_=/usr/bin/env
 
And, here is the environment when running the command, check_by_ssh
(THIS ONE FAILS):
 
SHELL=/bin/bash
SSH_CLIENT=10.8.24.170 58641 22
USER=nagios
LS_COLORS=
MAIL=/var/mail/nagios
PATH=/usr/bin:/bin:/usr/sbin:/sbin
PWD=/home/nagios
SHLVL=1
HOME=/home/nagios
LS_OPTIONS=-N --color=non -T O
LOGNAME=nagios
SSH_CONNECTION=10.8.24.170 58641 10.8.24.191 22
_=/usr/bin/env
 
I'm running both commands form the same server as user, nagios.  It
appears that check_by_ssh changes my env settings (notice that there are
no ORACLE environments specified).  Does check_by_ssh not use the
/etc/ssh/config settings?  Where is this done?  I would almost believe
that check_by_ssh bypasses the default ssh settings for sending env
variables.
________________________________

From: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of Bret
Goodfellow
Sent: Wednesday, October 11, 2006 7:39 AM
To: Az
Cc: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] check_oracle plugin returns - CRITICAL-
ORA-12154:TNS: count not resolve service name


Don't you find it surprising that the same user, nagios, can run ssh
successfully and not check_by_ssh?  Why would the environment variables
change?  Anyway, I'm still checking into what you said.  Thanks

________________________________

From: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of Az
Sent: Tuesday, October 10, 2006 2:35 PM
To: Bret Goodfellow
Cc: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] check_oracle plugin returns - CRITICAL -
ORA-12154:TNS: count not resolve service name


Bret Goodfellow wrote: 

	I'm wondering if this could be some sort of authentication
problem.  When I run the ssh command as nagios, I get the expected
reponse:
	 
	
	dev02: # su - nagios
	nagios at dev02:~> ssh -i /usr/local/nagios/.ssh/id_dsa olympus
"/usr/local/nagios/libexec/check_oracle --tablespace mwmt01 nagios
password TS01 98 96"
	
	mwmt01 : TS01 OK - 18.80% used [ 487 / 600 MB available
]|TS01=18.80%;96;98;0;100
	nagios at dev02:~>
	 
	When I run the ssh command as root, this is where I get the
failure:
	 
	nagios at dev02:~> su - root
	dev02: #  ssh -i /usr/local/nagios/.ssh/id_dsa olympus
"/usr/local/nagios/libexec/check_oracle --tablespace mwmt01 nagios
password TS01 98 96" 
	
	CRITICAL - ORA-12154: TNS:could not resolve service name
	dev02 <mailto:s at dev02> : #
	 
	Now, notice when I switch back to nagios and run check_by_ssh
(not to be confused with ssh), I get the same error as above:
	 
	
	dev02: # su - nagios
	
	nagios at dev02:~> /usr/local/nagios/libexec/check_by_ssh -H
olympus -i /usr/local/nagios/.ssh/id_dsa -C
"/usr/local/nagios/libexec/check_oracle --tablespace mwmt01 nagios
password TS01 98 96" -l nagios
	CRITICAL - ORA-12154: TNS:could not resolve service name
	
	nagios at dev02:~> 
	
	 
	Notice that the last two commands have the same result.  The
first is using ssh as user root, and the second is using check_by_ssh as
user nagios.  Yet, if I run ssh as user nagios I then get the expected
response.  Any ideas?
	
________________________________

	

While I am not an Oracle guru, my first thoughts are that the user does
not have the necessary oracle environment variables setup, thus your
tnsnames.ora cannot be located. I'd start off by confirming that point
first, then try using tnsping to test that the tnsnames.ora is setup
correctly. I dont recall how SSH and environment variables inheritance
occurs, which may be another issue in itself.

Cheers.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20061011/8afa6a71/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list