integ/tools/engtools/parsers/common/parse-controllers.sh
Sun Austin 847cf1e92f Fix linters issue E002 and E003 and linters check (none-voting)
E002 Tab indents
E003 Indent not multiple of 4

Story: 2003366
Task: 24424

Change-Id: Ie063ccfe346489f08c4752adaa344f5919db0378
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-08-31 04:08:52 +00:00

53 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
#Copyright (c) 2016 Wind River Systems, Inc.
#
#SPDX-License-Identifier: Apache-2.0
#
# This script is used to parse stats data for controller/CPE hosts. For large office,
# it is called by parse-everything.sh. For CPE, it should be called on its own.
# File lab.conf must exist with CONTROLLER_LIST config parameter set for the script to run
# Usage: ./parse-controllers.sh
PARSERDIR=$(dirname $0)
. ${PARSERDIR}/parse-util.sh
if [ ! -f lab.conf ]; then
echo "Lab configuration file is missing."
echo "See http://wiki.wrs.com/PBUeng/TitaniumServerSysengToolsAndDataAnalysis for more info."
exit 1
fi
source ./lab.conf
if [ -z "${CONTROLLER_LIST}" ]; then
echo "ERROR: Controller list is not set in lab.conf file. Exiting..."
exit 1
fi
for HOST in ${CONTROLLER_LIST}; do
LOG "Parsing stats data for controller host ${HOST}"
if [ -d ${HOST} ]; then
cd ${HOST}
bzip2 ${HOST}* > /dev/null 2>&1
../parse-all.sh ${HOST} > /dev/null 2>&1 &
# Delay the next controller because they both write to /tmp
sleep 120
cd ..
else
ERRLOG "${HOST} does not exist. Parsing skipped."
fi
done
# Parsing postgres connection stats is a time consuming step, run it in parallel with parse-all
# script.
for HOST in ${CONTROLLER_LIST}; do
if [ -d ${HOST} ]; then
LOG "Parsing postgres connection stats data for controller host ${HOST}"
cd ${HOST}
../parse-postgres.sh *postgres.bz2 > /dev/null 2>&1 &
cd ..
fi
done