Skip to content

Instantly share code, notes, and snippets.

@mbaldessari
Created October 1, 2020 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbaldessari/8beb9e5f33ab20cfcc7b89e373bf96e9 to your computer and use it in GitHub Desktop.
Save mbaldessari/8beb9e5f33ab20cfcc7b89e373bf96e9 to your computer and use it in GitHub Desktop.
sosreport collection in parallel
#!/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