[Nagiosplug-devel] loading environment variables to nagios

Matthew Litwin mlitwin at stubhub.com
Mon Mar 2 19:07:41 CET 2009


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.

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.


On 3/2/09 3:31 AM, "Ovidiu Marcu" <Ovidiu.Marcu at tdn.de> wrote:

> Hello,
>  
> Is there a way to load environment variables to nagios?
>  
> I have set up check_oracle_health in my nagios but it does not work:
> Nagios gives me the following message:
> CRITICAL - cannot connect to nagios. ORA-12154: TNS:could not resolve the
> connect identifier specified (DBD ERROR: OCIServerAttach)
> Which means that nagios cannot find the environment variable TNS_ADMIN which I
> have defined in /etc/profiles
>  
> If I try manually as user nagios I get:
> [nagios at nagios root]$ /usr/local/nagios/plugins/check_oracle_health
> --connect=nagios --user=nagios --password=pass --mode=tnsping
> OK - connection established to nagios.
>  
> The TNS_ADMIN env seems to be ok:
> [nagios at nagios root]$ echo $TNS_ADMIN
> /usr/lib/oracle/11.1/client64/bin/network/admin
>  
>  
> Viele Grüße,
>  
> ServiceDesk_TDN
> Ovidiu Marcu
>  
> 
> 
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> 
> _______________________________________________________
> Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20090302/e149a6e2/attachment.html>


More information about the Devel mailing list