integ/tools/engtools/parsers/large_office/parse-computes.sh
Scott Little aa3d640122 Relocate parsers to stx-integ/tools/engtools/parsers
Move content from stx-utils into stx-integ or stx-update

Packages will be relocated to

stx-update:
    enable-dev-patch
    extras

stx-integ:
    config-files/
        io-scheduler

    filesystem/
        filesystem-scripts

    grub/
        grubby

    logging/
        logmgmt

    tools/
        collector
        monitor-tools

    tools/engtools/
        hostdata-collectors
        parsers

    utilities/
        build-info
        branding   (formerly wrs-branding)
        platform-util

Change-Id: I5613b2a2240f723295fbbd2783786922ef5d0f8b
Story: 2002801
Task: 22687
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-08-01 12:42:03 -04:00

72 lines
2.4 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 storage and compute hosts. It is not
# relevant for CPE. For large office, it is called by parse-everything.sh script.
# File lab.conf must exist for the script to run. The STORAGE_LIST and COMPUTE_LIST
# config parameters can be set to suit the parsing needs.
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 "${STORAGE_LIST}" ]; then
# This script could be invoked from another script or run separately so write to both
# console and log file.
echo "STORAGE_LIST is not set in lab.conf file. Skipping stats parsing for all storage."
WARNLOG "STORAGE_LIST is not set in lab.conf file. Skipping stats parsing for all storage."
else
for HOST in ${STORAGE_LIST}; do
LOG "Parsing stats data for storage host ${HOST}"
if [ -d ${HOST} ]; then
cd ${HOST}
bzip2 ${HOST}* > /dev/null 2>&1
../parse-all.sh ${HOST} > /dev/null 2>&1 &
cd ..
else
ERRLOG "${HOST} does not exist. Parsing skipped."
fi
done
fi
if [ -z "${COMPUTE_LIST}" ]; then
echo "COMPUTE_LIST is not set in lab.conf file. Skipping stats parsing for all computes."
WARNLOG "COMPUTE_LIST is not set in lab.conf file. Skipping stats parsing for all computes."
exit 1
else
# If there is a large number of computes, they need to be parsed one batch at a time,
# otherwise, the analysis server will be brought down to a crawl. Set the number of
# computes to process in parallel as batches of 25 if it's not set in lab.conf
BATCH_SIZE=${BATCH_SIZE:-25}
count=0
for HOST in ${COMPUTE_LIST}; do
LOG "Parsing stats data for compute host ${HOST}"
if [ -d ${HOST} ]; then
cd ${HOST}
bzip2 ${HOST}* > /dev/null 2>&1
../parse-all.sh ${HOST} > /dev/null 2>&1 &
cd ..
((count++))
if [ $count == ${BATCH_SIZE} ]; then
# Wait for this batch to finish before starting a new one
wait
count=0
fi
else
ERRLOG "${HOST} does not exist. Parsing skipped."
fi
done
fi