Created
April 15, 2019 18:16
-
-
Save kwilczynski/85cd63c16d6a33471783b1a708c2a83f to your computer and use it in GitHub Desktop.
Allocator reconciliation - Platform vs Amazon Web Services (AWS)
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
for f in *.txt; do \ | |
( r=$(echo $f | sed -e 's/.*_//; s/\.txt//'); mkdir -p $r; grep -E '^ERROR' $f | \ | |
awk '{ print $2 }' | awk '{ print length, $0 }' | sort -n | awk '{ print $2 }' | \ | |
while read i; do ecl --config foundit --region $r allocators --all -f "instanceId:$i" --output json > "${r}/${i}.txt"; done ) & | |
done |
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
for r in $(ecl --config foundit regions --provider aws --output json | jq '. | keys | .[]' -r); do \ | |
( ecl --config foundit --region $r allocators --all --output json | jq '.zones[] | .allocators[] | .metadata[] | select(.key=="instanceId") | .value' -r | \ | |
awk '{ print length, $0 }' | sort -n | awk '{ print $2 }' | \ | |
while read i; do aws --profile foundit --region "$(echo $r | sed -e 's/^aws-//')" ec2 describe-instances --instance-id $i &>/dev/null && echo "OK $i" || echo "ERROR $i"; done | \ | |
tee -a allocators_${r}.txt >/dev/null ) & | |
done |
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
$ echo -e "# REGION,HEALTHY,MISSING,TOTAL"; for f in *.txt; do echo -n "$f," | sed -e 's/.*_//; s/\.txt//'; awk '{ if (/OK/) { x+=1 }; if (/ERROR/) { y+=1 }} END { print x+0","y+0","x+y}' $f; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment