[Nagiosplug-devel] loading environment variables to nagios

Ovidiu Marcu Ovidiu.Marcu at tdn.de
Tue Mar 3 10:12:25 CET 2009


I have solved my problem by modifying the script. I have added the need environments in the script.

Viele Grüße,

ServiceDesk_TDN
Ovidiu Marcu

From: Ovidiu Marcu
Sent: Tuesday, March 03, 2009 10:25 AM
To: Nagios Plugin Development Mailing List
Subject: RE: [Nagiosplug-devel] loading environment variables to nagios

Hi,

The user nagios loads the environment variable automatically from /etc/profile .
The plugin is executed on the nagios server and it connects to the oracle directly on port 1512
Can you give me example on how to execute the command if I add the /.bashrc file in nagios home dir.


Viele Grüße,

ServiceDesk_TDN
Ovidiu Marcu

From: Matthew Litwin [mailto:mlitwin at stubhub.com]
Sent: Monday, March 02, 2009 8:08 PM
To: Nagios Plugin Development Mailing List
Subject: Re: [Nagiosplug-devel] loading environment variables to nagios

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/20090303/5786cf2d/attachment.html>


More information about the Devel mailing list