<HTML>
<HEAD>
<TITLE>Re: [Nagiosplug-devel] loading environment variables to nagios</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>The easiest solution would be to have your nagios user load the profile of your Oracle user. On my system, both the oracle and nagios user have bash for their shell, so I copy oracle’s .bashrc to nagios’ home dir. If you are executing your commands via nrpe, you need to precede each of your oracle plugin commands with . ~nagios/.bashrc; in order for all those Oracle related environment variables to be properly set.<BR>
<BR>
Also, you might need to add the nagios user to whatever group your oracle user account is in in order for the nagios user to be able to read Oracle’s logs and files.<BR>
<BR>
<BR>
On 3/2/09 3:31 AM, "Ovidiu Marcu" <<a href="Ovidiu.Marcu@tdn.de">Ovidiu.Marcu@tdn.de</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hello,<BR>
 <BR>
Is there a way to load environment variables to nagios?<BR>
 <BR>
I have set up check_oracle_health in my nagios but it does not work:<BR>
Nagios gives me the following message:<BR>
CRITICAL - cannot connect to nagios. ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach)<BR>
Which means that nagios cannot find the environment variable TNS_ADMIN which I have defined in /etc/profiles<BR>
 <BR>
If I try manually as user nagios I get:<BR>
[nagios@nagios root]$ /usr/local/nagios/plugins/check_oracle_health --connect=nagios --user=nagios --password=pass --mode=tnsping<BR>
OK - connection established to nagios.<BR>
 <BR>
The TNS_ADMIN env seems to be ok:<BR>
[nagios@nagios root]$ echo $TNS_ADMIN<BR>
/usr/lib/oracle/11.1/client64/bin/network/admin<BR>
<FONT COLOR="#1F497D"> <BR>
</FONT> <BR>
Viele Grüße,<BR>
 <BR>
ServiceDesk_TDN<BR>
Ovidiu Marcu<BR>
 <BR>
<BR>
<HR ALIGN=CENTER SIZE="3" WIDTH="95%"></SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'>------------------------------------------------------------------------------<BR>
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA<BR>
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise<BR>
-Strategies to boost innovation and cut costs with open source participation<BR>
-Receive a $600 discount off the registration fee with the source code: SFAD<BR>
<a href="http://p.sf.net/sfu/XcvMzF8H">http://p.sf.net/sfu/XcvMzF8H</a><BR>
<HR ALIGN=CENTER SIZE="3" WIDTH="95%">_______________________________________________________<BR>
Nagios Plugin Development Mailing List <a href="Nagiosplug-devel@lists.sourceforge.net">Nagiosplug-devel@lists.sourceforge.net</a><BR>
Unsubscribe at <a href="https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel">https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel</a><BR>
::: Please include plugins version (-v) and OS when reporting any issue. <BR>
::: Messages without supporting info will risk being sent to /dev/null<BR>
</SPAN></FONT></FONT></BLOCKQUOTE>
</BODY>
</HTML>