Environment Variables
Posted: Thu Jan 20, 2022 2:10 pm
Hi Nagios,
I'm trying to set some environment variables LD_LIBRARY_PATH (for DB2 & Oracle) ORACLE_HOME, DB2_HOME. Right now I'm passing them in as part of the command. I'm looking for a more elegant solution.
Commands (I'm passing the Environment Variables via env)
/usr/bin/env LD_LIBRARY_PATH=/opt/dsdriver/lib /usr/local/nagios/libexec/check_db2_health $ARG1$
/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/18.3/client64/lib ORACLE_HOME=/usr/lib/oracle/18.3/client64 $USER1$/check_oracle_health $ARG1$
LD_LIBRARY_PATH="/usr/lib/oracle/18.3/client64/lib:/opt/dsdriver/lib:$LD_LIBRARY_PATH"
ORACLE_HOME="/usr/lib/oracle/18.3/client64"
DB2_HOME="/opt/dsdriver"
I added the Nagios file to /etc/sysconfig/nagios. (My syntax inside the file may be off). That wasn't doing anything so I added the EnvironmentFile & eventually Environment arguments to /etc/systemd/system/multi-user.target.wants/nagios.service.
I set up the service to grab the environment. It shows that the variables are in there.
Ok
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
PWD=/tmp
LANG=en_US.UTF-8
Environment=LD_LIBRARY_PATH="/usr/lib/oracle/18.3/client64/lib:/opt/dsdriver/lib:$LD_LIBRARY_PATH" ORACLE_HOME="/usr/lib/oracle/18.3/client64" DB2_HOME="/opt/dsdriver"
SHLVL=1
_=/usr/bin/env
I'm still getting that missing linked library when I run the check_db2_health plugin & check_oracle plugin. The message goes away when the LD_LIBRARY_PATH variable is there & set. So, what's the best practice for getting environment variables in Nagios?
I saw that Nagios has the Oracle environment variables in /usr/local/nagiosxi/etc/configwizards/oracle/oracle. who is calling that & how does that work?
Thanks,
Max Ramirez
I'm trying to set some environment variables LD_LIBRARY_PATH (for DB2 & Oracle) ORACLE_HOME, DB2_HOME. Right now I'm passing them in as part of the command. I'm looking for a more elegant solution.
Commands (I'm passing the Environment Variables via env)
/usr/bin/env LD_LIBRARY_PATH=/opt/dsdriver/lib /usr/local/nagios/libexec/check_db2_health $ARG1$
/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/18.3/client64/lib ORACLE_HOME=/usr/lib/oracle/18.3/client64 $USER1$/check_oracle_health $ARG1$
LD_LIBRARY_PATH="/usr/lib/oracle/18.3/client64/lib:/opt/dsdriver/lib:$LD_LIBRARY_PATH"
ORACLE_HOME="/usr/lib/oracle/18.3/client64"
DB2_HOME="/opt/dsdriver"
I added the Nagios file to /etc/sysconfig/nagios. (My syntax inside the file may be off). That wasn't doing anything so I added the EnvironmentFile & eventually Environment arguments to /etc/systemd/system/multi-user.target.wants/nagios.service.
I set up the service to grab the environment. It shows that the variables are in there.
Ok
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
PWD=/tmp
LANG=en_US.UTF-8
Environment=LD_LIBRARY_PATH="/usr/lib/oracle/18.3/client64/lib:/opt/dsdriver/lib:$LD_LIBRARY_PATH" ORACLE_HOME="/usr/lib/oracle/18.3/client64" DB2_HOME="/opt/dsdriver"
SHLVL=1
_=/usr/bin/env
I'm still getting that missing linked library when I run the check_db2_health plugin & check_oracle plugin. The message goes away when the LD_LIBRARY_PATH variable is there & set. So, what's the best practice for getting environment variables in Nagios?
I saw that Nagios has the Oracle environment variables in /usr/local/nagiosxi/etc/configwizards/oracle/oracle. who is calling that & how does that work?
Thanks,
Max Ramirez