integ/tools/engtools/parsers/common/parse-rabbitmq-queue.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

58 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
#Copyright (c) 2016 Wind River Systems, Inc.
#
#SPDX-License-Identifier: Apache-2.0
#
OUTFILE=$1
QUEUENAME=$2
FILES=$(ls *rabbitmq.bz2 | sort)
[ -e tmp.txt ] && rm tmp.txt
echo "Time/Date,Name,Pid,Messages,Messages Ready,Messages Unacknowledged,Memory,Consumers" >${OUTFILE}
for FILE in ${FILES}; do
bzcat $FILE | grep -E "time\:|${QUEUENAME}" >>tmp.txt
sed -i -e "s/\t/ /g" tmp.txt
done
while IFS='' read -r LINE || [[ -n "${LINE}" ]]; do
TEST=$(echo ${LINE} | awk '{print $1}')
TEST2=$(echo ${LINE} | awk '{print $2}')
if [[ "${TEST}" == "time:" ]]; then
TIMEDATE=$(echo ${LINE} | awk '{print $3" "$4}')
MESSAGES=""
NAME=""
PID=""
MESSAGES_READY=""
MESSAGES_UNACKNOWLEDGED=""
MEMORY=""
CONSUMERS=""
elif [[ "${TEST2}" == "${QUEUENAME}" ]]; then
MESSAGES=$(echo ${LINE} | awk '{print $1}')
NAME=$(echo ${LINE} | awk '{print $2}')
PID=$(echo ${LINE} | awk '{print $3}')
MESSAGES_READY=$(echo ${LINE} | awk '{print $4}')
MESSAGES_UNACKNOWLEDGED=$(echo ${LINE} | awk '{print $5}')
MEMORY=$(echo ${LINE} | awk '{print $6}')
CONSUMERS=$(echo ${LINE} | awk '{print $7}')
echo "${TIMEDATE},${NAME},${PID},${MESSAGES},${MESSAGES_READY},${MESSAGES_UNACKNOWLEDGED},${MEMORY},${CONSUMERS}" >> ${OUTFILE}
TIMEDATE=""
MESSAGES=""
NAME=""
PID=""
MESSAGES_READY=""
MESSAGES_UNACKNOWLEDGED=""
MEMORY=""
CONSUMERS=""
fi
done < tmp.txt
rm tmp.txt