<!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><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>