Last active
December 27, 2017 08:04
-
-
Save psachin/36c7e4ff04bdd0a07a64065d0c477eaf to your computer and use it in GitHub Desktop.
Check workers with exceeded memory on Red Hat CloudForms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Niladri Roy <[email protected]> | |
# Usage: | |
# 1) without specifing evm.log file | |
# curl -s https://gist.githubusercontent.com/psachin/36c7e4ff04bdd0a07a64065d0c477eaf/raw | bash - | |
# 2) specify file name | |
# curl -s https://gist.githubusercontent.com/psachin/36c7e4ff04bdd0a07a64065d0c477eaf/raw | bash -s evm.log-20171103 | |
if [ -z $1 ]; | |
then | |
EVM="evm.log" | |
else | |
EVM=$1 | |
fi | |
tfile1=$(mktemp /tmp/foo.XXXXXXXXX) | |
tfile2=$(mktemp /tmp/foo.XXXXXXXXX) | |
#HEADER | |
#echo "WorkerName, EmsID WorkerType MemoryReached MemoryLimit" | column -t | |
#Get the workernames and corresponding emsIDs, output in below format | |
#daa-v-fwrk01, 1000000000001 | |
#daa-v-fwui01, 1000000000003 | |
grep evm_worker_memory_exceeded ${EVM} | grep "Target: MiqServer" | awk '{print $13,$15}' | sed 's/[][]//g' | sort | uniq | column -t > $tfile1 | |
#Get the details of the workers which exceed memory limit, along with emsid of the workers | |
#1000000000001 :type=>"ManageIQ::Providers::Vmware::InfraManager::MetricsCollectorWorker", 400.673 400 | |
#1000000000001 :type=>"MiqEmsMetricsProcessorWorker", 600.009 600 | |
#1000000000001 :type=>"MiqGenericWorker", 500.058 500 | |
#1000000000003 :type=>"MiqGenericWorker", 575.303 500 | |
#1000000000003 :type=>"MiqPriorityWorker", 664.268 600 | |
#1000000000003 :type=>"MiqScheduleWorker", 677.194 500 | |
grep "Delivering {:event_type=>.evm_worker_memory_exceeded" ${EVM} | sed 's/\[//g'|sed 's/\]//g'| awk '{print $38,$31, $23/2^20,$26/2^20}' | sort | awk '!seen[$1, $2]++' | awk -F. '{n=index($0,".");$2=substr($0,n+1);NF=2;print $2}' | column -t > $tfile2 | |
#Add the worker names to the final output | |
awk 'NR==FNR{a[$2]=$1$2} NR>FNR{$1=a[$1];print}' "$tfile1" "$tfile2" | column -t |
Author
psachin
commented
Dec 27, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment