Friday, August 10, 2012

How to extract PowerHA configuration from ODM for quick recovery

In AIX, ODM holds a lot of information and configuration.

In the event that ODM goes kaput, all hell will break loose. Especially for powerHA, having a backup of the configuration will aid in the recovery of powerHA configuration issues.

As i'm still learning to use AIX and powerHA, do let me know if my method is good enought. :)

I have written the script to extract powerHA configurations.

#/bin/ksh
#
# Script Name : spool_HA_config.sh
# Written     : 08 Aug 2012
# Author      : Victor Kwan At gmail
#
# Description : This is to spool the powerHA 7 configuration on a
#               AIX 7.1 machine.
#               This script should be cron to run regularly for
#               quick recovery if powerHA configuration gets corrupted
#               in AIX ODM.
#
# Updates     : 08 Aug 2012 : First version
#             : 10 Aug 2012 : spooled files now uses DDMMYYYY_HHmmSS format
#


# Declarations
#
DATE=`date +'%d%m%Y_%H%M%S'`

# Safety Measure
#
WHO=`/usr/bin/whoami`

if [ ${WHO} != root ]
then
        echo "You shouldn't be running this using ${WHO}! Script will now terminate."
fi

#
# Spool the HA configuration from ODM
/usr/es/sbin/cluster/utilities/clsnapshot -c -i -n HA_snap_`hostname`_${DATE} -d "HA snapshot on ${DATE}" >/dev/null 2>&1

# Ends
# ~


The main star in this script is the clsnapshot command. By default, the output of clsnapshot command will be saved at /usr/es/sbin/cluster/snapshots.

Below is the sample of the files spooled. There are 2 files, one *.odm and one *.info. I think both are required to be imported to powerHA if we need to recover from configuration issues.

-rw-r--r--    1 root     system        57482 Aug 10 01:00 HA_snap_serverA_10082012_010000.odm
-rw-r--r--    1 root     system        86579 Aug 10 01:00 HA_snap_serverA_10082012_010000.info



Of course, there are many things we need to keep watch on, we wouldn't want to run this script manually. Hence, put it in root cron to be run daily.

# PowerHA configuration daily spool
0 1 * * * /myscript_folder/spool_HA_config.sh >/myscript_folder/spool_HA_config.output 2>&1


 and we are done.

No comments: