Created
August 26, 2022 13:15
-
-
Save derms/c35ef80ebfb5a727be27525f4c21a905 to your computer and use it in GitHub Desktop.
TigerGraph support-collect
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
#!/bin/bash | |
# TigerGraph Support Collector v1.0 | |
# Revised 3/17/2022 | |
supportdir="support_collection_"$(date +%F_%H%M) | |
echo; read -p "Would you like to collect logs (this may take some time)? [y/n]" | |
if [[ $REPLY =~ ^[Yy]$ ]]; then | |
echo; echo "Collecting logs..." | |
gcollect -o ./$supportdir -c gpe,gse,gsql,rest -t 86400 collect | |
else | |
mkdir $supportdir | |
fi | |
echo; read -p "Would you like to collect config? [y/n]" | |
if [[ $REPLY =~ ^[Yy]$ ]]; then | |
echo; echo "Collecting config..." | |
gadmin config dump > $supportdir/config.json | |
fi | |
echo; echo "Collecting current state..." | |
{ | |
printf "===gadmin status -v===\n" | |
gadmin status -v | |
printf "===gadmin version===\n" | |
gadmin version | |
printf "\n===gssh===\n" | |
gssh | |
if gadmin version | grep release_3; then | |
printf "\n===gstatusgraph===" | |
gstatusgraph | |
else | |
printf "\n===gadmin status graph -v===" | |
gadmin status graph -v | |
fi | |
printf "\n===license status===" | |
gadmin license status | |
printf "\n===date===" | |
grun_p all "date" | |
printf "\n===df -h===" | |
grun all "df -h" | |
printf "\n===free -h===" | |
grun all "free -h" | |
printf "\n===3.x tg processes running===" | |
grun all "ps aux | grep $(gadmin config get System.AppRoot)/bin/" | |
printf "===GPE binary checksum===" | |
grun_p all "md5sum $(gadmin config get System.AppRoot)/bin/tg_dbs_gped" | |
printf "\n===top===" | |
grun all "top -b -n 1 | head -n 25" | |
printf "\n===lscpu===" | |
grun all "lscpu" | |
} > $supportdir/support.log 2>&1 | |
foldersize=$(du -s $supportdir | cut -f1); uploads=$((($foldersize/200000)+1)) | |
if [ $uploads = 1 ]; then | |
input=2 | |
else | |
echo; echo "Due to Freshdesk size limits, this may require around $((($foldersize/200000)+1)) separate uploads, what would you like to do?" | |
echo -e "1. Split the collection archive\n2. Leave the collection as a single archive\n3. Do not archive/compress collection folder" | |
read input; | |
fi | |
if [ $input = 1 ] || [ $input = 2 ]; then | |
echo; echo "Compressing collection (this may take some time)..." | |
tar -Jcf $supportdir.tar.xz $supportdir; rm -rf $supportdir | |
if [ $input = 1 ]; then | |
mkdir $supportdir; | |
split --verbose -b 20M $supportdir.tar.xz $supportdir/$supportdir.tar.xz.part; | |
rm $supportdir.tar.xz; | |
fi; | |
fi; | |
echo; echo "Collection has been saved under $supportdir." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment