<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.3790.2759" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466512720-11102006>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.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466512720-11102006>Below is the environment established for ssh (THIS IS
THE ONE THAT WORKS!!):</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>SHELL=/bin/bash</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>SSH_CLIENT=10.8.24.170 58641 22</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>USER=nagios</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>LS_COLORS=</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>ORACLE_SID=ver_9206</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>ORACLE_BASE=/oracle</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>ORACLE_ADHOC=/oracle/local/adhoc</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>MAIL=/var/mail/nagios</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>PATH=/usr/bin:/bin:/usr/sbin:/sbin</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>TNS_ADMIN=/oracle/network/admin</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>PWD=/home/nagios</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>LANG=en_US.UTF-8</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>SQLPATH=/oracle/local/adhoc:%PATH</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>SHLVL=1</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>HOME=/home/nagios</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>LS_OPTIONS=-N --color=non -T O</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>LOGNAME=nagios</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>SSH_CONNECTION=10.8.24.170 58641 10.8.24.191
22</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>ORACLE_HOME=/oracle/product/9.2.0.6</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>_=/usr/bin/env</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466512720-11102006>And, here is the environment when running the command,
check_by_ssh (THIS ONE FAILS):</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466512720-11102006>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>SHELL=/bin/bash</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>SSH_CLIENT=10.8.24.170 58641 22</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>USER=nagios</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>LS_COLORS=</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>MAIL=/var/mail/nagios</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>PATH=/usr/bin:/bin:/usr/sbin:/sbin</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>PWD=/home/nagios</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>SHLVL=1</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>HOME=/home/nagios</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>LS_OPTIONS=-N --color=non -T O</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>LOGNAME=nagios</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>SSH_CONNECTION=10.8.24.170 58641 10.8.24.191
22</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>_=/usr/bin/env</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Courier color=#0000ff size=2><SPAN
class=466512720-11102006>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466512720-11102006>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.</SPAN></FONT></DIV></SPAN></FONT></DIV></SPAN></FONT></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> nagios-users-bounces@lists.sourceforge.net
[mailto:nagios-users-bounces@lists.sourceforge.net] <B>On Behalf Of </B>Bret
Goodfellow<BR><B>Sent:</B> Wednesday, October 11, 2006 7:39 AM<BR><B>To:</B>
Az<BR><B>Cc:</B> nagios-users@lists.sourceforge.net<BR><B>Subject:</B> Re:
[Nagios-users] check_oracle plugin returns - CRITICAL- ORA-12154:TNS: count not
resolve service name<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><SPAN class=398523613-11102006><FONT face=Arial
color=#0000ff size=2>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</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> nagios-users-bounces@lists.sourceforge.net
[mailto:nagios-users-bounces@lists.sourceforge.net] <B>On Behalf Of
</B>Az<BR><B>Sent:</B> Tuesday, October 10, 2006 2:35 PM<BR><B>To:</B> Bret
Goodfellow<BR><B>Cc:</B> nagios-users@lists.sourceforge.net<BR><B>Subject:</B>
Re: [Nagios-users] check_oracle plugin returns - CRITICAL - ORA-12154:TNS: count
not resolve service name<BR></FONT><BR></DIV>
<DIV></DIV>Bret Goodfellow wrote:
<BLOCKQUOTE
cite=mid91EDB00F83BAD443A9D05FA67623955A862974@QMAIL.corp.questar.com
type="cite">
<META content="MSHTML 6.00.3790.2759" name=GENERATOR>
<DIV dir=ltr align=left><SPAN class=750361717-10102006><FONT face=Arial
color=#0000ff size=2>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:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=750361717-10102006></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=750361717-10102006>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=538290722-06102006><STRONG>dev02: # su -
nagios</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=538290722-06102006><STRONG>nagios@dev02:~> ssh -i
/usr/local/nagios/.ssh/id_dsa olympus "/usr/local/nagios/libexec/check_oracle
--tablespace mwmt01 nagios password TS01 98 96"</STRONG></SPAN></FONT></DIV>
<DIV><SPAN class=538290722-06102006>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=538290722-06102006><STRONG>mwmt01 : TS01 OK - 18.80% used [ 487 / 600 MB
available ]|TS01=18.80%;96;98;0;100</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=538290722-06102006><STRONG>nagios@dev02:~></STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=538290722-06102006><STRONG></STRONG></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=538290722-06102006><SPAN class=750361717-10102006>When I run the ssh
command as root, this is where I get the failure:</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=538290722-06102006><SPAN
class=750361717-10102006></SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=538290722-06102006><SPAN
class=750361717-10102006><STRONG>nagios@dev02:~> su -
root</STRONG></SPAN></SPAN></FONT></DIV>
<DIV><FONT size=+0><SPAN class=538290722-06102006><SPAN
class=750361717-10102006><FONT color=#0000ff><FONT face=Arial><FONT
size=2><STRONG>dev02: #</STRONG> <STRONG>ssh -i
/usr/local/nagios/.ssh/id_dsa olympus "/usr/local/nagios/libexec/check_oracle
--tablespace mwmt01 nagios password TS01 98 96"</STRONG></FONT></FONT></FONT>
<DIV><SPAN class=538290722-06102006>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=538290722-06102006><STRONG><SPAN
class=538290722-06102006><STRONG>CRITICAL - ORA-12154: TNS:could not resolve
service name</STRONG></SPAN></STRONG></SPAN></FONT></DIV>
<DIV><SPAN class=538290722-06102006><STRONG><A href="mailto:s@dev02"><FONT
face=Arial><FONT size=2><SPAN
class=750361717-10102006>d</SPAN>ev02</FONT></FONT></A><FONT face=Arial
color=#0000ff size=2>:<SPAN class=750361717-10102006>
#</SPAN></FONT></STRONG></SPAN></DIV>
<DIV><SPAN class=538290722-06102006><STRONG><FONT face=Arial color=#0000ff
size=2><SPAN
class=750361717-10102006></SPAN></FONT></STRONG></SPAN> </DIV>
<DIV><SPAN class=538290722-06102006><FONT face=Arial color=#0000ff
size=2><SPAN class=750361717-10102006>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:</SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=538290722-06102006><FONT face=Arial color=#0000ff
size=2><SPAN class=750361717-10102006></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=538290722-06102006><FONT face=Arial color=#0000ff
size=2><SPAN class=750361717-10102006><SPAN class=750361717-10102006>
<DIV><SPAN class=538290722-06102006><STRONG>dev02: # su -
nagios</STRONG></SPAN></DIV>
<DIV><SPAN class=538290722-06102006><SPAN class=538290722-06102006>
<DIV><SPAN class=538290722-06102006><STRONG><A
href="mailto:nagios@dev02">nagios@dev02</A>:~>
/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"<SPAN class=750361717-10102006>
-l nagios</SPAN></STRONG></SPAN></DIV>
<DIV><SPAN class=538290722-06102006><STRONG>CRITICAL - ORA-12154: TNS:could
not resolve service name</STRONG></SPAN></DIV>
<DIV><SPAN class=538290722-06102006>
<DIV><SPAN class=538290722-06102006><STRONG>nagios@dev02:~>
</STRONG></SPAN></DIV></SPAN></DIV></SPAN></SPAN><FONT face=Arial
color=#0000ff size=2><SPAN class=538290722-06102006><SPAN
class=750361717-10102006></SPAN></SPAN></FONT></DIV></SPAN></SPAN></FONT></SPAN></DIV></SPAN></DIV></SPAN></SPAN></FONT></DIV></SPAN></DIV></SPAN></DIV>
<DIV><FONT size=+0><FONT face=Arial color=#0000ff
size=2></FONT></FONT> </DIV>
<DIV><SPAN class=750361717-10102006></SPAN><FONT size=+0><FONT face=Arial
color=#0000ff size=2><FONT face=Arial><FONT color=#0000ff><FONT size=2>N<SPAN
class=750361717-10102006>otice that the last two commands have the same
result. The first is using <STRONG>ssh</STRONG> as user <U>root</U>, and
the second is using <STRONG>check_by_ssh</STRONG> as user <U>nagios</U>.
Yet, if I run ssh as user nagios I then get the expected response. Any
ideas?</SPAN></FONT></FONT></FONT><BR></FONT></FONT></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT size=+0><FONT face=Arial color=#0000ff size=2><FONT face=Tahoma
size=2><B></B></FONT></FONT></FONT></DIV></BLOCKQUOTE>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.<BR><BR>Cheers.<BR></BODY></HTML>