TWiki Webs: Main TWiki Netview
Edit | Attach | Ref-By | Printable | Raw Text | Diffs | r1.1 | More
Content
Netview web home Register Changes Index Search

Go to topic

Change Password
Links
NetView global user group IBM NetView product page nv-l mailing list archive
With many thanks to Bill Evans for this contribution....

This worked to keep two machines in sync at one account I worked. It was run every night from a cron job on the primary host and the trap sent to the backup host caused it to run there. It could as well be run manually or by cron on the backup machine. It may require some tuning and definitely requires trap definition on the backup machine.

Happy reverse engineering.

NETVIEW_BACKUP

set -x
SourceHost="<hostname>"
BackupHost="<backup_hostname"
TrapParameters='6 1999 0 .1.3.6.1.4.1.2.6.3.1.1.1.0 OctetString "Normal"'
date_qual=`date | awk '{print $2 $3 }'`    # Derive a unique date qualifier

# do some periodic maintenance on the databases so we save clean ones
ovstop netmon                            # stop the network daemon
ovtopofix -a                             # clean up the topology DB
ovmapcount -u                            # clean up the map DB

# Copy the content of the configuration and databases into a unique file
# Note: we may want to include a subset of the configuration if each site needs uniqueness
tar -cvf /usr/OV/backup_data/${date_qual}_conf.tar /usr/OV/conf/*  /usr/OV/www/conf/* 
tar -cvf /usr/OV/backup_data/${date_qual}_ovdb.tar /usr/OV/databases/openview/*

ovstart netmon                            # restart the network daemon

# Compress the files so they will transfer quickly.
compress /usr/OV/backup_data/${date_qual}_conf.tar
compress /usr/OV/backup_data/${date_qual}_ovdb.tar

# Transfer the files to the backup server through the utility account
cp /usr/OV/backup_data/${date_qual}_conf.tar.Z /home/nvadmin/conf.tar.Z
cp /usr/OV/backup_data/${date_qual}_ovdb.tar.Z /home/nvadmin/ovdb.tar.Z

# Policy determination is that we will use {NFS|RCP|TFTP} initiated from the backup site
# to transfer these files when the following trap is received.   

# Forward a unique custom trap to the backup host to initiate the companion restore on that system
/usr/OV/bin/snmptrap ${BackupHost} .1.3.6.1.4.1.2.6.3 &${SourceHost} ${TrapParameters}

# snmptrap [-d] [-t timeout] [-r retries] [-p port] [-c community]
#      node enterprise-oid agent-addr generic-trap specific-trap time-stamp
#      [variable type value] 
#   see the man page for snmptrap for details

NETVIEW_RESTORE

#
#  This process pulls the copies of the weekly backup of the configuration
#  and databases from the primary NetView server followed by the decompression
#  of those files and their placement in the NetView directory tree.
#  This process is expected to be run when the custom NetView6000 trap 1999 is received.
#

set -x
site="<backup_hostname>"     # This is the backup site
primary_site="<hostname>"          # This is the primary site
date_qual=`date | awk '{print $2 $3 }'`    # Derive a unique date qualifier

# Copy the files from the primary server to this node using the utility ID
rcp nvadmin@${site}:/home/nvadmin/*.tar.Z /home/nvadmin

# Uncompress the files we received.
compress -d /home/nvadmin/conf.tar.Z
compress -d /home/nvadmin/ovdb.tar.Z

# Stop the NetView daemons for the duration of the restoration.     
ovstop                                     # stop the NetView daemons

# Copy the content of the current local configuration and databases into unique files
tar -cvf /usr/OV/backup_data/${date_qual}_conf.tar /usr/OV/conf/* /usr/OV/www/conf/* 
tar -cvf /usr/OV/backup_data/${date_qual}_ovdb.tar /usr/OV/databases/openview/*

# Restore the local configuration and databases from the primary server images
# Tar is used for the configuration and PAX is used for the databases because the
# databases are "sparse" files requiring special treatment for restoration.
tar -xvf /home/nvadmin/conf.tar 
pax -rp e -f /home/nvadmin/ovdb.tar

ovstart                            # restart the network daemon

# Compress the local backup files so they will take less space. 
compress /usr/OV/backup_data/${date_qual}_conf.tar
compress /usr/OV/backup_data/${date_qual}_ovdb.tar

# Reset the system names in the databases
# Reset_ci is the magic command which makes this transport possible.
/usr/OV/service/reset_ci
mapadmin -u $site

# erase the incoming files
#rm /home/nvadmin/*.tar 

-- JaneCurry - 17 Nov 2004