Skip to content

Commit

Permalink
Merge pull request #126 from ibm-apiconnect/apicops_mustgather
Browse files Browse the repository at this point in the history
apicops must gather added
  • Loading branch information
saberhamidi committed Feb 21, 2024
2 parents 61b26e0 + c4da820 commit 1ad0e09
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions generate_postmortem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,48 @@ for NAMESPACE in $NAMESPACE_LIST; do
$CURRENT_PATH/edb_mustgather.sh $NAMESPACE $K8S_NAMESPACES_EDB &> "${K8S_NAMESPACES_EDB}/edb-collect.log"
fi

#grab apicops mustgather
MGMT=$(kubectl get mgmt -n $NAMESPACE 2>&1)
if [[ $MGMT != *"No resources found"* ]]; then

which apicops &> /dev/null
if [[ $? -eq 0 ]]; then
APICOPS="apicops"
else
if [[ ! -e /tmp/apicops-v10-linux ]]; then
echo -e "apicops cli not found!"
read -p "Download and Install apicops cli (y/n)? " yn
case $yn in
[Yy]* )
echo -e "Downloading apicops......"
curl -L -o /tmp/apicops-v10-linux https://github.com/ibm-apiconnect/apicops/releases/latest/download/apicops-v10-linux
if [[ ! -e /tmp/apicops-v10-linux ]]; then
echo -e "Warning: Failed to download the apicops cli. Skipping to collect apicops mustgather. Please download the latest release of apicops manually before running the postmortem script. commands: curl -LO https://github.com/ibm-apiconnect/apicops/releases/latest/download/apicops-v10-linux"
else
chmod +x /tmp/apicops-v10-linux
APICOPS="/tmp/apicops-v10-linux"
fi
;;
[Nn]* )
echo -e "Skipping to collect apicops mustgather"
;;
esac
else
APICOPS="/tmp/apicops-v10-linux"
fi
fi

if [ -v APICOPS ]; then
K8S_NAMESPACES_APICOPS_DATA="${K8S_NAMESPACES_SPECIFIC}/apicops"
mkdir -p $K8S_NAMESPACES_APICOPS_DATA

#List of apicops commands to be run for mustgather
$APICOPS iss -n $NAMESPACE > "${K8S_NAMESPACES_APICOPS_DATA}/iss.out"
$APICOPS debug:info -n $NAMESPACE > "${K8S_NAMESPACES_APICOPS_DATA}/debug-info.out"

fi
fi

#grab daemonset data
OUTPUT=`$KUBECTL get daemonset -n $NAMESPACE 2>/dev/null`
if [[ $? -eq 0 && ${#OUTPUT} -gt 0 ]]; then
Expand Down Expand Up @@ -1574,6 +1616,8 @@ for NAMESPACE in $NAMESPACE_LIST; do
echo "$OUTPUT1" >"${PORTAL_DIAGNOSTIC_DATA}/list_sites-platform.out"
OUTPUT1=`$KUBECTL exec -n $NAMESPACE -c $container $pod -- bash -ic "/opt/ibm/bin/list_sites -d" 2>"/dev/null"`
echo "$OUTPUT1" >"${PORTAL_DIAGNOSTIC_DATA}/list_sites-database.out"
OUTPUT1=`$KUBECTL exec -n $NAMESPACE -c $container $pod -- bash -ic "/opt/ibm/bin/check_site -a" 2>"/dev/null"`
echo "$OUTPUT1" >"${PORTAL_DIAGNOSTIC_DATA}/check_site-all.out"
OUTPUT1=`$KUBECTL exec -n $NAMESPACE -c $container $pod -- bash -ic "/opt/ibm/bin/list_platforms" 2>"/dev/null"`
echo "$OUTPUT1" >"${PORTAL_DIAGNOSTIC_DATA}/list_platforms.out"
OUTPUT1=`$KUBECTL exec -n $NAMESPACE -c $container $pod -- bash -ic "ls -lRAi --author --full-time" 2>"/dev/null"`
Expand Down

0 comments on commit 1ad0e09

Please sign in to comment.