Created
February 7, 2019 05:26
-
-
Save aemneina/c3847c285d82f2fef78ebb01969377a7 to your computer and use it in GitHub Desktop.
memory dump for rancher server
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 | |
# Create temp directory | |
TMPDIR=$(mktemp -d) | |
cd /tmp/debug | |
curl localhost:6060/debug/pprof/goroutine -o $TMPDIR/goroutine | |
curl localhost:6060/debug/pprof/heap -o $TMPDIR/heap | |
curl localhost:6060/debug/pprof/threadcreate -o $TMPDIR/threadcreate | |
curl localhost:6060/debug/pprof/block -o $TMPDIR/block | |
curl localhost:6060/debug/pprof/mutex -o $TMPDIR/mutex | |
FILENAME="$(hostname)-$(date +'%Y-%m-%d_%H_%M_%S').tar" | |
tar cf /tmp/$FILENAME -C ${TMPDIR}/ . | |
if $(command -v gzip >/dev/null 2>&1); then | |
gzip /tmp/${FILENAME} | |
FILENAME="${FILENAME}.gz" | |
fi | |
echo "Created /tmp/${FILENAME}" | |
echo "You can now remove ${TMPDIR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment