I use check_oracle_health and check_sql_query plugins for Oracle monitoring. Everything works fine, but after reboot Nagios server they can't see Envirement variables (TNS_ADMIN, ORACLE_HOME and etc.). Therefore in web interface I see CRITICAL errors. For example TNSPING in web interface returns: "CRITICAL - cannot connect to storacle. Died ."
Every time after reboot I have to restart nagios service (/etc/init.d/nagios restart) manually, then Nagios can see oracles again.
At the same time I can sqlplus to oracles under user nagios from SSH withot restart nagios-service. Mentioned above scripts work fine from command-line after reboot also, but in Web interface shows it's cannot connect to oracles.
I set oracle variables via startup script oracle.sh:-bash-3.2$ ./check_oracle_health --mode tnsping --connect ebpp --user nagios --password nagmonpw --method sqlplus
OK - connection established to ebpp.
Code: Select all
# cat [b]/etc/profile.d/oracle.sh[/b]
#!/bin/bash
export ORACLE_HOME=/usr/lib/oracle/11.2/client
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export TNS_ADMIN=$ORACLE_HOME
Code: Select all
-bash-3.2$ env
HOSTNAME=nagios.corp.domain.loc
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
MIBDIRS=/usr/local/share/snmp/mibs
SSH_TTY=/dev/pts/0
USER=nagios
[b]LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib[/b]
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
SNMPCONFPATH=/etc/snmp/snmp.conf
[b]TNS_ADMIN=/usr/lib/oracle/11.2/client[/b]
MAIL=/var/spool/mail/nagios
[b]PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/lib/oracle/11.2/client/bin[/b]
INPUTRC=/etc/inputrc
PWD=/home/nagios
EDITOR=/bin/vi
LANG=en_US.UTF-8
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHLVL=1
HOME=/home/nagios
LOGNAME=nagios
CVS_RSH=ssh
LESSOPEN=|/usr/bin/lesspipe.sh %s
[b]ORACLE_HOME=/usr/lib/oracle/11.2/client[/b]
G_BROKEN_FILENAMES=1
_=/bin/env