Skip to content

Instantly share code, notes, and snippets.

@psachin
Last active Dec 27, 2017
Embed
What would you like to do?
Check workers with exceeded memory on Red Hat CloudForms
# Author: Niladri Roy <niroy@redhat.com>
# 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
@psachin
Copy link
Author

psachin commented Dec 27, 2017

grep "Delivering {:event_type=>.evm_worker_memory_exceeded" evm.log | sed 's/\[//g'|sed 's/\]//g' | awk '{print $38,$31, $23/2^20,$26/2^20}' | sort -u

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment