Nonstop Database, HiRDB Version 9 System Operation Guide

[Contents][Index][Back][Next]

22.1.4 Shell script for creating unload statistics log files at a specified server machine

Executor: HiRDB administrator

In the case of a HiRDB parallel server configuration, a shell script (pdstjacm) can be used to collect all the unload statistics log files acquired at the individual server machines under a specified server machine's directory. This section describes the shell script for creating unload statistics log files at a specific server machine.

Organization of this subsection
(1) Function of pdstjacm
(2) Contents of pdstjacm

(1) Function of pdstjacm

pdstjacm is a HiRDB-provided shell script. Executing pdstjacm collects the statistics log information output from multiple server machines under the directory of a specified server machine. Unload statistics log files appropriate to the user's environment can be created by modifying the contents of pdstjacm. When the contents of pdstjacm are not modified, all the unload statistics log files are collected under $PDDIR/spool/stjfiles at the host used to execute pdstjacm. The following figure provides an overview of pdstjacm.

Figure 22-3 Overview of pdstjacm

[Figure]

Explanation
The statistics log information from node1, node2, and node3 is collected under the $PDDIR/spool/stjfiles directory.

(2) Contents of pdstjacm

pdstjacm is stored as pdstjacm under $PDDIR/bin. The shell script should be copied before it is modified. In addition to pdstjacm, the OS's rcp command (remote copy) and NFS (network file system) can also be used. The following are the contents of pdstjacm:

 
#!/bin/sh
# ALL RIGHTS RESERVED,COPYRIGHT (C) 1994,1995,HITACHI,LTD.
# LICENSED MATERIAL OF HITACHI,LTD.
# Name          : pdstjacm
# Function      : Collects statistics log files at host at which command is entered.
# Command Line  : pdstjacm [sysdef filename]
# Command option: sysdef filename - If name of system common definition at local
#                                   host is omitted, $PDCONFPATH/pdsys is assumed.
# Note          : (1) Change the OUTDIR as required.
#                 (2) Statistic log file is collected for each host under a separate 
#                     subdirectory of the $OUTDIR directory;
#                     the name of a subdirectory under $OUTDIR is the same as the
#                     corresponding host name.
#                 (3) rcp command is used to transfer statistics log files between
#                     hosts.
#                 (4) A definition of pdstart operand and pdunit operand in definition
#                     files must not be written over several lines. If pdstart operand
#                     or pdunit operand is written over several lines in definition
#                     files, this command("pdstjacm") doesn't work correctly.
#
#                    (Example)
#                      pdstart -t SDS \ |    |
#                       -s sds01 \      | -> | pdstart -t SDS -s sds01 -x host01
#                       -x host01       |    |
#
#                      pdunit -u unt1 \ |    |
#                       -x host01 \     | -> | pdunit -u unt1 -x host01 -d "/HiRDB_S"
#                       -d "/HiRDB_S"   |    |
#
#                 (5) When system switching occurs, this command("pdstjacm") doesn't
#                     work correctly. Change the hostname(s) of the executing system
#                     to the one(s) of the standby system, in order to collect the 
#                     statistics log files of the standby system.
#                 (6) Pdstjacm shell is getten HiRDB operational directory name from
#                     system common definition file ($PDCONFPATH/pdsys or specified
#                     first argument). If pdunit operand in definition files is written
#                     over several lines in definition files, pdstjacm shell may be
#                     executed using $PDDIR in .cshrc on several local hosts.
#                 (7) If pdstart operands and/or pdunit operands are specified wrong
#                     in definition files, this command("pdstjacm") doesn't work
#                     correctly.
#
#******************************************************************************
##  Definition for canceling processing when Signal is received
trap "echo processing is canceled.; exit 1" 1 2 15
 
##  Definition of literals
OUTDIR=$PDDIR/spool/stjfiles      ......................#1
##  OUTDIR is directory under which statistics log files are collected.
##  Modify as required.
 

##  Checking of number of arguments
if [ $2 ] ; then
         echo  "Usage: $0 [input_file]"
         echo  "$0 processing is canceled."
         exit 1
fi
 
##  Checking of input definition file
if [ $# -eq 1 ]
then DEFFILE=$1
else DEFFILE=$PDCONFPATH/pdsys
fi
if [ ! -r $DEFFILE ] ; then
         echo "$DEFFILE is not found or cannot be read."
         echo "$0 processing is canceled."
         exit 1
fi
  
##  Set host name in ${proc_host}.
proc_host=`cat $DEFFILE | sed -n '/^[   ]*pdunit.*[   ]-x/{s/.*[   ]-x//;p;}' \
                         | awk '{print $1}' - | sort | uniq`
set ${proc_host:=no_host_name}
 
if [ $1 = no_host_name ] ; then
proc_host=`cat $DEFFILE | sed -n '/^[   ]*pdstart.*[   ]-x/{s/.*[   ]-x//;p;}' \
                         | awk '{print $1}' - | sort | uniq`
set ${proc_host:=no_host_name}
 
##  Validity checking of host name
if [ $1 = no_host_name ] ; then
         echo "No host name to be processed."
         echo "pdstjacm processing terminated."
         exit 1
fi
fi
 
##  Checking of transfer destination directory
if [ ! -d $OUTDIR ] ; then
         mkdir $OUTDIR
fi
 
##  Checking of transfer destination directory
if [ ! -d $OUTDIR ] ; then
         mkdir $OUTDIR
fi
 
 
##  Copy local host statistics log file   ..........#3
set ${proc_host}          ..........................1
while [ $# -ne 0 ]
do
     if [ ! -d $OUTDIR/$1 ] ; then
              mkdir $OUTDIR/$1
     fi
     proc_dir=`cat $DEFFILE | /bin/grep '[   ]-x[   ]*'$1'[   ]' \
               | sed -n '/^[   ]*pdunit/{s/.*[   ]-d//;p;}' | awk '{print $1}' -`
     if [ -z "$proc_dir" ] ; then
       proc_dir=`cat $DEFFILE | /bin/grep '[   ]-x[   ]*'$1'$' \
              | sed -n '/^[   ]*pdunit/{s/.*[   ]-d//;p;}' | awk '{print $1}' -`
     fi
##  Validity checking of pddir name on pdunit operand
         case ${proc_dir} in
                  /*)
                         rcp $1:$proc_dir/spool/pdstj1 $OUTDIR/$1
                         rcp $1:$proc_dir/spool/pdstj2 $OUTDIR/$1
                 ;;
                 *)
                         rcp $1:'$'PDDIR/spool/pdstj1 $OUTDIR/$1   ..........#2
                         rcp $1:'$'PDDIR/spool/pdstj2 $OUTDIR/$1
                 ;;
         esac
##  rcp command is used to transfer statistics log files between hosts      ................4
##  Environment must be set up so that remote shell can be executed between hosts.
         shift
done      .................2
 
##  End of processing
echo "pdstjacm : Processing completed."
exit 0
 

#1: To create unload log files on a specified server machine, the $PDDIR/spool/stjfiles section is modified.

#2: If statistical log files cannot be collected on a specified server machine, compile the '$'PDDIR/spool/pdstj1 and '$'PDDIR/spool/pdstj2 parts.

#3: If control is passed to the standby HiRDB by the system switchover facility and this shell is executed as is, statistics log files will not be collected correctly. In such a case, the shell script from 1 through 2 must be modified as follows:

 
 if[ ! -d $OUTDIR/HOST1 ] ; then
  mkdir $OUTDIR/HOST1
 fi          # Copying statistics log file on HOST1
 rcp HOST1:HOST1_pddir/spool/pdstj1 $OUTDIR/HOST1
 rcp HOST1:HOST1_pddir/spool/pdstj2 $OUTDIR/HOST1
 
 if [ ! -d $OUTDIR/HOST2 ] ; then
  mkdir $OUTDIR/HOST2
 fi          # Copying statistics log file on HOST2
 rcp HOST2:HOST2_pddir/spool/pdstj1 $OUTDIR/HOST2
 rcp HOST2:HOST2_pddir/spool/pdstj2 $OUTDIR/HOST2
 

Repeat above script as many times as there are units whose statistics log is output. In this case, modify the following literals appropriately:

HOST1, HOST2: Statistics-log-output-host-name

HOST1_pddir, HOST2_pddir: Statistics-log-output-HiRDB-directory

#4: To use the rcp command when acquiring a statistics log, set /etc/hosts.equiv and $HOME/.rhosts correctly. Furthermore, since pdstjacm uses the rcp command to acquire the statistics log of the server machine that executed the command, you need to specify the local host name in /etc/hosts.equiv and $HOME/.rhosts.