Created
October 1, 2020 19:47
-
-
Save mbaldessari/8beb9e5f33ab20cfcc7b89e373bf96e9 to your computer and use it in GitHub Desktop.
sosreport collection in parallel
This file contains 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
#!/bin/bash | |
set -ex | |
mkdir sosreports || /bin/true | |
declare -A pids | |
nodes=$(openstack --os-cloud undercloud server list -f value -c Networks |cut -f2 -d\=) | |
for i in $nodes; do | |
echo "Collecting for $i" | |
ssh $i 'sudo sosreport --quiet --batch; sudo chmod 644 /var/tmp/sos*xz' & | |
pids["$i"]="$!" | |
done | |
echo "Waiting for all nodes to complete: ${!pids[@]}" | |
for i in $nodes; do | |
wait "${pids[$i]}" | |
done | |
echo "Fetch all sosreports" | |
for i in $nodes; do | |
scp $i:/var/tmp/sos*xz sosreports/ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment