Oracle monitoring script for hacmp ?


 
Thread Tools Search this Thread
Operating Systems AIX Oracle monitoring script for hacmp ?
# 1  
Old 08-09-2011
Oracle monitoring script for hacmp ?

Hi,

does anyone happen to have a sample of a hacmp monitoring script for oracle? With the process monitoring I seem to be only able to monitor the listener but not oracle itself ?

Thanks in advance
zxmaus
# 2  
Old 08-09-2011
Not a HACMP-ready script, but should be easy to alter so IIRC HACMP just triggers if the exit code is 0 or not.

When I wrote scripts to check the "alive" status of DB2 or TSM, I usually just checked the return code of a simple SELECT on a system table. By doing this you can bypass checking for processes as this does not tell if they are still working or not.

Let me dig one out... bypass that OV (HP Open View /OMW) stuff and the German gibberish Smilie This script was one of many in a self written monitoring construct. The maybe interesting part for you is the bold marked.

Code:
#!/bin/ksh
#
# Skript: /usr/local/OV/OV__SOME__LIB_db2.ksh
#
# FS-PERMS:icmlib:db2iadm1:500
#
# Checkt fuer HP Open View, ob die DB2 verfuegbar ist. Liefert folgende
# Exitcodes:
#       0       Kein Fehler
#       1       Fehler (schreibt Lockfile)
#       2       Fehler noch vorhanden (Lockfile ist schon vorhanden)
#       3       Kein Fehler mehr vorhanden (Lockfile wird geloescht)
#       5       Kein UP-Flag
#
# Muss als Instanz Owner ausgefuehrt werden, sonst gibts Probleme.
#
# 21.05.04, M.
# 10.07.06, M.
# 02.08.06, M.
#############################################################################
#set -x

# Flag-Pruefung
flag_check()
{
  FLAG_DIR=/usr/local/var/app_status
  THIS_APP="LIB_db2"
  if [[ `cat ${FLAG_DIR}/${THIS_APP}` = "UP" ]]; then
        echo "UP -- Pruefung erfolgt nun... -- `date`"
  else
        echo "DOWN -- Es erfolgt keine Pruefung -- `date`"
        exit 5
  fi
}
flag_check

. ~icmlib/.profile

# OV spezifisches:
###################
OPC=/usr/lpp/OV/OpC/opcmsg

OV_NODE="node=`hostname`"               # Hostname
OV_APP='a="DB2"'                        # Applikation
OV_OBJ='o="Lib"'                        # Objekt, z.B. Instanz
OV_MGRP='msg_grp="SOME"'                # Message Group
OV_SID='service_id="SOME Archive:SOME Lib"'           # Angesprochener Knoten
                                        # Schweregrad:
OV_SV1='severity="critical"'
OV_SV2='severity="normal"'
                                        # Text-Messages:
OV_MSG1="msg_text=\"FEHLER: Datenbank fuer Library Server nicht erreichbar! --- Quelle: $0\""
OV_MSG2="msg_text=\"OK: Datenbank fuer Library Server wieder erreichbar. --- Quelle: $0\""


# Pruefungslogik
#################

LOCKFILE=/var/locks/OV_lib-db2.lock

db2 connect to icmlib_p > /dev/null 2>&1
db2 -x "select * from ICMUT01014001 fetch first 5 rows only" > /dev/null 2>&1

STATUS=`echo $?`

db2 connect reset > /dev/null 2>&1

if [[ ${STATUS} -gt 0 ]]; then
        if [[ -e ${LOCKFILE} ]]; then
                echo "ERROR -- `date`"
                exit 2
        fi

        touch ${LOCKFILE}
        echo ${OV_APP} ${OV_OBJ} ${OV_MGRP} ${OV_NODE} ${OV_SID} ${OV_SV1} ${OV_MSG1} |\
        xargs ${OPC}
        echo "ERROR -- `date`"
        exit 1
else
        if [[ -e ${LOCKFILE} ]]; then
                rm ${LOCKFILE}
                echo ${OV_APP} ${OV_OBJ} ${OV_MGRP} ${OV_NODE} ${OV_SID} ${OV_SV2} ${OV_MSG2} |\
                xargs ${OPC}
                echo "OK -- `date`"
                exit 3
        fi
fi

echo "OK -- `date`"
exit 0

This User Gave Thanks to zaxxon For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

ldapsearch in monitoring script without bind password written in script

Hi I do a very simple monitoring of our OpenLDAP (runs in cronjob and generate alerts if unsuccessfull) $ ldapsearch -h hostname.domain -D "cn=monitor_user,ou=People,dc=organisation" -w "password" -b "dc=organisation" -x "(&(cn=monitor_user)(ou=People))" dn | grep -v version dn:... (4 Replies)
Discussion started by: slashdotweenie
4 Replies

2. AIX

Interoperability Oracle Clusterware - PowerHA/HACMP

I am planning for building a new database server using AIX 6.1 and Oracle 11.2 using ASM. As i have learned starting with Oracle 11.2 ASM can only be used in conjunction with Clusterware, which is Oracles HA-software. As is the companies policy we do intend to use PowerHA as HA-solution instead... (1 Reply)
Discussion started by: bakunin
1 Replies

3. AIX

HACMP does not start db2 after failover (db2nodes not getting modified by hacmp)

hi, when I do a failover, hacmp always starts db2 but recently it fails to start db2..noticed the issue is db2nodes.cfg is not modified by hacmp and is still showing primary node..manually changed the node name to secondary after which db2 started immediately..unable to figure out why hacmp is... (4 Replies)
Discussion started by: gkr747
4 Replies

4. Shell Programming and Scripting

Run script on HACMP nodes?

Hello All, Anybody knows how can I run script on the AIX HACMP offline node, without logon a offline node? I would like to run a script on the online node and at same time or after the online node on the offline node. Any IDEA? :confused: (3 Replies)
Discussion started by: kalaso
3 Replies

5. UNIX and Linux Applications

Monitoring Tablespaces on Oracle Databases.

can anyone provide me with a basic command that can do this? like, is there a one liner command line i can run that will spit out some digits to me. (digits i can write a script to monitor)??? (0 Replies)
Discussion started by: SkySmart
0 Replies

6. Infrastructure Monitoring

HACMP Monitoring

Hi, I would like to know, what are the tools for monitoring HACMP cluster (3 Replies)
Discussion started by: Balaram
3 Replies

7. AIX

Aix hacmp cluster question (oracle & sap)

Hello, I was wondering if I have 3 nodes (A, B, C) all configured to startup with HACMP, but I would like to configure HACMP in such a way: 1) Node B should startup first. After the cluster successfully starts up and mounts all the filesystems, then 2) Node A, and Node C should startup ! ... (4 Replies)
Discussion started by: filosophizer
4 Replies

8. AIX

hacmp script cache

Hi All, Is there some kind of cache for the hacmp script? Because I modified the script for sure but the first failover still execute the old script. Only on the succeeding failover is fine. Anyone who had encounter this with hacmp, I'm using 5.3. Regards. (1 Reply)
Discussion started by: itik
1 Replies
Login or Register to Ask a Question