I've got Nagios and Oracle sqlplus client installed on my server. Sqlplus needs few environment variables for its run, so I added exports to /etc/profile
.
Login as root sets variables right, login as user nagios sets is also OK but when I run some checks from nagios web interface (these checks are written in bash), they end with an error Error: Empty result from sqlplus. Check plugin settings and Oracle status.
When I run these checks from terminal as root or as nagios user, everything is OK, that's how I found out that problem is in env variables.
I will be glad for any suggestions.
I found that is a bug from nagios, you can check documentation from this link.
You will find in file /etc/init.d/nagios
this code.
# Load any extra environment variables for Nagios and its plugins
if test -f /etc/sysconfig/nagios; then
. /etc/sysconfig/nagios
fi
Just create the file nagios
on the /etc/sysconfig/
path for Fedora or rhel with the extra variables that you need.
on case.
[root@server sysconfig]# cat nagios
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
and that's it.
Best regard Marco.