File: //var/opt/OV/bin/instrumentation/oa_cntrl
#!/bin/sh
###############################################################
# @(#)ovpa_cntrl 11.00.000 30 Jan 2007 =*=
#
# Executes the ovpa script
#
# Parameters: all parameters will be passed to the ovpa script
#
###############################################################
###
#
#
# ERROR and WARNING Codes
#
#
###
ERR_OVPA_NOT_INSTALLED=1
ERR_UNREGONIZED_OPTION=2
ERR_MISSING_PARAMETER=3
ERR_UNKNOWN_INPUT=4
ERR_MISSING_LOGFILE=5
###
#
#
# Initialize variables
#
#
###
SYS="`uname -s`"
PATH=$PATH:/bin:/usr/bin:/usr/ucb:/usr/ccs/bin:/sbin:/usr/bin/X11
export PATH
###
#
#
# MAIN BODY
#
#
###
###
#
# Exit if the number of arguments is more then 2
#
###
if [ $# -gt 2 ]; then
echo "ERROR: Unregonized option is passed."
echo " Please correct the options and re-run the tool.\n"
exit ${ERR_UNREGONIZED_OPTION}
fi
FIRST_ARG=$1
ARG1=`echo $FIRST_ARG | tr ' ' '\012' | tr '[A-Z]' '[a-z]'`
# Capture the subsystem if any
if [ $# -eq 2 ]; then
SECOND_ARG=$2
ARG2=`echo $SECOND_ARG | tr ' ' '\012' | tr '[A-Z]' '[a-z]'`
fi
#Determine out where the PERF/bin directory is
case "$SYS" in
AIX)
PERF_BIN_DIR="/usr/lpp/perf/bin"
OV_BIN_DIR="/usr/lpp/OV/bin"
;;
*)
PERF_BIN_DIR="/opt/perf/bin"
OV_BIN_DIR="/opt/OV/bin"
;;
esac
PERF_DATA_DIR="/var/opt/perf"
OV_DATA_DIR="/var/opt/OV"
###
#
#
# Call ovpa script to do the operation
#
#
###
#if [ ! -x $PERF_BIN_DIR/ovpa ]; then
# echo "ERROR: HP Performance Agent Software is not installed on the node."
# exit ${ERR_OVPA_NOT_INSTALLED}
#fi
case "${ARG1}" in
start)
echo "====================================================================="
echo "= Output of Start Agent ="
echo "====================================================================="
echo
## if the option START has some argument
## validate the argument and execute the
## appropriate command
# start invoked has no subsystem so starting all services
$OV_BIN_DIR/OpC/opcagt -start
echo
echo "====================================================================="
echo "= Output of Start Agent ="
echo "====================================================================="
;;
stop)
echo "====================================================================="
echo "= Output of Stop Agent ="
echo "====================================================================="
echo
# start invoked has no subsystem so starting all services
$OV_BIN_DIR/OpC/opcagt -stop
echo
echo "====================================================================="
echo "= Output of Stop Agent ="
echo "====================================================================="
;;
restart)
echo "====================================================================="
echo "= Output of Restart Agent ="
echo "====================================================================="
echo
# start invoked has no subsystem so starting all services
$OV_BIN_DIR/OpC/opcagt -restart
echo
echo "====================================================================="
echo "= Output of Restart Agent ="
echo "====================================================================="
;;
status)
echo "====================================================================="
echo "= Output of View Status ="
echo "====================================================================="
echo
$OV_BIN_DIR/OpC/opcagt -status
echo
echo "====================================================================="
echo "= Output of View Status ="
echo "====================================================================="
;;
getlicense)
echo "====================================================================="
echo "= Output of Get license ="
echo "====================================================================="
echo
$OV_BIN_DIR/oalicense -get -all
echo
echo "====================================================================="
echo "= Output of Get license ="
echo "====================================================================="
;;
setrtmdlicense)
echo "====================================================================="
echo "= Output of Set Realtime license ="
echo "====================================================================="
echo
$OV_BIN_DIR/oalicense -set -type PERMANENT "HP Ops OS Inst to Realtime Inst LTU"
echo
echo "====================================================================="
echo "= Output of Set Realtime license ="
echo "====================================================================="
;;
setglancelicense)
echo "====================================================================="
echo "= Output of Set Glance license ="
echo "====================================================================="
echo
$OV_BIN_DIR/oalicense -set -type PERMANENT "Glance Software LTU"
echo
echo "====================================================================="
echo "= Output of Set Glance license ="
echo "====================================================================="
;;
parmchk)
# Utility writes output to stderr, so we have to capture
# it in a file and cat the file
echo "============================================================================================="
echo "= Output of Check Performance Component's parameter file syntax ="
echo "============================================================================================="
echo
> /tmp/parmchk$$
$PERF_BIN_DIR/utility -xp > /tmp/parmchk$$ 2>&1
cat /tmp/parmchk$$
rm -f /tmp/parmchk$$ > /dev/null 2>&1
echo
echo "============================================================================================="
echo "= Output of Check Performance Component's parameter file syntax ="
echo "============================================================================================="
;;
alarmchk)
# Utility writes output to stderr, so we have to capture
# it in a file and cat the file
echo "============================================================================================="
echo "= Output of Check Performance Component's alarmdef file syntax ="
echo "============================================================================================="
echo
> /tmp/alarmchk$$
$PERF_BIN_DIR/utility -xc > /tmp/alarmchk$$ 2>&1
cat /tmp/alarmchk$$
rm -f /tmp/alarmchk$$ > /dev/null 2>&1
echo
echo "============================================================================================="
echo "= Output of Check Performance Component's alarmdef file syntax ="
echo "============================================================================================="
;;
scan)
echo "============================================================================================="
echo "= Output of scan Performance Component's log files ="
echo "============================================================================================="
echo
> /tmp/scan$$
$PERF_BIN_DIR/utility -xs -D > /tmp/scan$$ 2>&1
cat /tmp/scan$$
rm -f /tmp/scan$$ > /dev/null 2>&1
echo
echo "============================================================================================="
echo "= Output of scan Performance Component's log files ="
echo "=============================================================================================="
;;
version)
echo "====================================================================="
echo "= Output of View version information ="
echo "====================================================================="
echo
$OV_BIN_DIR/ovdeploy -inv
echo
echo "====================================================================="
echo "= Output of View version information ="
echo "====================================================================="
;;
tailstatus)
echo "====================================================================="
echo "= Output of View status files ="
echo "====================================================================="
echo
echo "y" | $PERF_BIN_DIR/perfstat -t
echo
echo "====================================================================="
echo "= Output of View status files ="
echo "====================================================================="
;;
deployresult)
echo "=========================================================================="
echo "= Output of View status of Operations agent deploy action ="
echo "=========================================================================="
echo
CHECKTHIS=$ARG2;
if [ ! -f $PERF_DATA_DIR/policydep_$CHECKTHIS.log ]; then
echo "ERROR: $PERF_DATA_DIR/policydep_$CHECKTHIS.log file not found. Either the corresponding ConfigFile policy was not deployed or the .log file was deleted"
else
cat $PERF_DATA_DIR/policydep_$CHECKTHIS.log | grep "Processing"
fi
echo
echo "=========================================================================="
echo "= Output of View status of Operations agent deploy action ="
echo "=========================================================================="
;;
*)
echo "ERROR: Unregonized option is passed.\n"
exit ${ERR_UNREGONIZED_OPTION}
esac
exit 0