Xymon Mailing List Archive search

error foe script to monitor database

list Sailesh
Thu, 8 Dec 2011 09:47:31 +0400
Message-Id: <002701ccb56c$f6911360$e3b33a20$@user-02c0a994364f@xymon.invalid>

Hi all,

 
I have a script to monitor my oracle databse. I am getting the error below
on my browser. The script where the error is happening is below. The problem
is that the script is retuning a null value instead of my sid which is cnp1.

 
Please can anyone help where there is a problem in the script.

 
Database check: cnp1 is down or in hung state 
ERROR: ORA-12154: TNS:could not resolve the connect identifier specified
SP2-0306: Invalid option. Usage: CONN[ECT] [{logon|/|proxy} [AS
{SYSDBA|SYSOPER|SYSASM}] [edition=value]] where ::= [/][@] ::= [][/][@]
SP2-0306: Invalid option. Usage: CONN[ECT] [{logon|/|proxy} [AS
{SYSDBA|SYSOPER|SYSASM}] [edition=value]] where ::= [/][@] ::= [][/][@]
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

 
################################################################

# DATABASE CHECK function

################################################################

function FUNC_DATABASE_CHECK

{

[[ "$DEBUG" = "Y" ]] && set -xv

set -f # turn off globbing

 
DB_CHECK=`$SQLPLUS -s $DB_USER/$DB_PASSWORD <<EOF 2>&1

set feedback off

set pagesize 0

set trimspool on

ttitle off

btitle off

set verify off

set linesize 260

select '$ORACLE_SID is up' FROM dual

/

EOF

`

if [[ "$DB_CHECK" != "$ORACLE_SID is up" ]]; then

        echo "$SPACER&red Database check: ${ORACLE_SID} is down or in hung
state"

        for line in $DB_CHECK

        do

                DB="$DB $line"

                [[ "$line" = "" ]] && break

        done

        [[ -n $DB ]] && DB_CHECK="$DB"  # move it to look good

        echo "<br>$DB_CHECK<br>"

        [[ "$DATABASE_NOTIFY" = "N" ]] && [[ "$COLOR" != "red" ]] &&
COLOR="yellow" || CO

LOR='red'

else

        echo "$SPACER&green Database check: ${ORACLE_SID} is up"

fi

}

 
Regards,

Sailesh