-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collect ceph data for External mode #10594
Open
OdedViner
wants to merge
3
commits into
red-hat-storage:master
Choose a base branch
from
OdedViner:collect_data_external_mode
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+204
−0
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
|
||
dbglog() { | ||
# Allow the input to be piped | ||
declare msg=${1:-$(</dev/stdin)} | ||
|
||
echo -e "${msg}" | tee -a "${BASE_COLLECTION_PATH}"/gather-debug.log | ||
} | ||
|
||
|
||
# Expect base collection path as an exported variable | ||
# If it is not defined, use PWD instead | ||
BASE_COLLECTION_PATH=${1:-"$(pwd)"} | ||
echo $BASE_COLLECTION_PATH | ||
|
||
KUBECONFIG=${2:-"~/.kube/config"} | ||
ns=${3:-"openshift-storage"} | ||
|
||
TOOL_POD_NAME=$(oc get pods --no-headers -n ${ns} -l app='rook-ceph-tools' | awk '{print $1}') | ||
if [ -z "$TOOL_POD_NAME" ]; then | ||
dbglog "No tool pod found" | ||
echo "No tool pod found" | ||
exit -1 | ||
fi | ||
|
||
|
||
gather_common_ceph_resources "${BASE_COLLECTION_PATH}" | ||
CEPH_GATHER_DBGLOG="${BASE_COLLECTION_PATH}"/gather-ceph-debug.log | ||
CEPH_COLLECTION_PATH="${BASE_COLLECTION_PATH}/ceph" | ||
COMMAND_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/must_gather_commands | ||
COMMAND_JSON_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/must_gather_commands_json_output | ||
COMMAND_ERR_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/logs | ||
mkdir -p "${COMMAND_OUTPUT_DIR}" | ||
mkdir -p "${COMMAND_JSON_OUTPUT_DIR}" | ||
mkdir -p "${COMMAND_ERR_OUTPUT_DIR}" | ||
|
||
|
||
pids_ceph=() | ||
|
||
# Ceph commands1 | ||
ceph_commands1=() | ||
ceph_commands1+=("ceph auth list") | ||
ceph_commands1+=("ceph balancer pool ls") | ||
ceph_commands1+=("ceph balancer status") | ||
ceph_commands1+=("ceph config dump") | ||
ceph_commands1+=("ceph config-key ls") | ||
ceph_commands1+=("ceph crash ls") | ||
ceph_commands1+=("ceph crash stat") | ||
ceph_commands1+=("ceph device ls") | ||
ceph_commands1+=("ceph df detail") | ||
ceph_commands1+=("ceph fs dump") | ||
ceph_commands1+=("ceph fs ls") | ||
ceph_commands1+=("ceph fs status") | ||
ceph_commands1+=("ceph health detail") | ||
ceph_commands1+=("ceph healthcheck history ls") | ||
ceph_commands1+=("ceph mds stat") | ||
ceph_commands1+=("ceph mgr dump") | ||
ceph_commands1+=("ceph mgr module ls") | ||
ceph_commands1+=("ceph mgr services") | ||
ceph_commands1+=("ceph mon stat") | ||
ceph_commands1+=("ceph mon dump") | ||
ceph_commands1+=("ceph osd df tree") | ||
ceph_commands1+=("ceph osd tree") | ||
ceph_commands1+=("ceph osd stat") | ||
ceph_commands1+=("ceph osd dump") | ||
ceph_commands1+=("ceph osd utilization") | ||
ceph_commands1+=("ceph osd crush show-tunables") | ||
ceph_commands1+=("ceph osd crush dump") | ||
ceph_commands1+=("ceph osd crush weight-set ls") | ||
|
||
# Ceph commands2 | ||
ceph_commands2=() | ||
ceph_commands2+=("ceph osd crush weight-set dump") | ||
ceph_commands2+=("ceph osd crush rule dump") | ||
ceph_commands2+=("ceph osd crush rule ls") | ||
ceph_commands2+=("ceph osd crush class ls") | ||
ceph_commands2+=("ceph osd perf") | ||
ceph_commands2+=("ceph osd numa-status") | ||
ceph_commands2+=("ceph osd getmaxosd") | ||
ceph_commands2+=("ceph osd pool ls detail") | ||
ceph_commands2+=("ceph osd lspools") | ||
ceph_commands2+=("ceph osd df") | ||
ceph_commands2+=("ceph osd blocked-by") | ||
ceph_commands2+=("ceph osd blacklist ls") | ||
ceph_commands2+=("ceph osd pool autoscale-status") | ||
ceph_commands2+=("ceph pg dump") | ||
ceph_commands2+=("ceph pg stat") | ||
ceph_commands2+=("ceph progress") | ||
ceph_commands2+=("ceph progress json") | ||
ceph_commands2+=("ceph quorum_status") | ||
ceph_commands2+=("ceph rbd task list") | ||
ceph_commands2+=("ceph report") | ||
ceph_commands2+=("ceph service dump") | ||
ceph_commands2+=("ceph status") | ||
ceph_commands2+=("ceph time-sync-status") | ||
ceph_commands2+=("ceph versions") | ||
ceph_commands2+=("ceph log last 10000 debug cluster") | ||
ceph_commands2+=("ceph log last 10000 debug audit") | ||
ceph_commands2+=("rados lspools") | ||
ceph_commands2+=("rados ls --pool=ocs-storagecluster-cephblockpool") | ||
ceph_commands2+=("rados ls --pool=ocs-storagecluster-cephfilesystem-metadata --namespace=csi") | ||
|
||
|
||
|
||
# Collecting output of ceph osd config | ||
for i in $(timeout 120 oc -n "${ns}" exec "${TOOL_POD_NAME}" -- bash -c "ceph osd tree --connect-timeout=15 | grep up " | awk '{print $4}'); do | ||
{ timeout 120 oc -n "${ns}" exec "${TOOL_POD_NAME}" -- bash -c "ceph config show $i" >>"${COMMAND_OUTPUT_DIR}/config_$i"; } >>"${COMMAND_ERR_OUTPUT_DIR}"/gather-config-"$i"-debug.log 2>&1 & | ||
pids_ceph+=($!) | ||
done | ||
# Check if PID array has any values, if so, wait for them to finish | ||
if [ ${#pids[@]} -ne 0 ]; then | ||
echo "Waiting on subprocesses to finish execution." | ||
wait "${pids[@]}" | ||
fi | ||
|
||
|
||
# Collecting output of ceph commands | ||
for ((i = 0; i < ${#ceph_commands1[@]}; i++)); do | ||
dbglog "collecting command output for: ${ceph_commands1[$i]}" | ||
COMMAND_OUTPUT_FILE=${COMMAND_OUTPUT_DIR}/${ceph_commands1[$i]// /_} | ||
JSON_COMMAND_OUTPUT_FILE=${COMMAND_JSON_OUTPUT_DIR}/${ceph_commands1[$i]// /_}_--format_json-pretty | ||
{ timeout 120 oc --kubeconfig="${KUBECONFIG}" -n "${ns}" exec "${TOOL_POD_NAME}" -- bash -c "${ceph_commands1[$i]} --connect-timeout=15" >>"${COMMAND_OUTPUT_FILE}"; } >>"${COMMAND_ERR_OUTPUT_DIR}"/gather-"${ceph_commands1[$i]}"-debug.log 2>&1 & | ||
pids_ceph+=($!) | ||
{ timeout 120 oc --kubeconfig="${KUBECONFIG}" -n "${ns}" exec "${TOOL_POD_NAME}" -- bash -c "${ceph_commands1[$i]} --connect-timeout=15 --format json-pretty" >>"${JSON_COMMAND_OUTPUT_FILE}"; } >>"${COMMAND_ERR_OUTPUT_DIR}"/gather-"${ceph_commands1[$i]}"-json-debug.log 2>&1 & | ||
pids_ceph+=($!) | ||
done | ||
# Check if PID array has any values, if so, wait for them to finish | ||
if [ ${#pids[@]} -ne 0 ]; then | ||
echo "Waiting on subprocesses to finish execution." | ||
wait "${pids[@]}" | ||
fi | ||
|
||
|
||
# Collecting output of ceph commands | ||
for ((i = 0; i < ${#ceph_commands2[@]}; i++)); do | ||
dbglog "collecting command output for: ${ceph_commands2[$i]}" | ||
COMMAND_OUTPUT_FILE=${COMMAND_OUTPUT_DIR}/${ceph_commands2[$i]// /_} | ||
JSON_COMMAND_OUTPUT_FILE=${COMMAND_JSON_OUTPUT_DIR}/${ceph_commands2[$i]// /_}_--format_json-pretty | ||
{ timeout 120 oc --kubeconfig="${KUBECONFIG}" -n "${ns}" exec "${TOOL_POD_NAME}" -- bash -c "${ceph_commands2[$i]} --connect-timeout=15" >>"${COMMAND_OUTPUT_FILE}"; } >>"${COMMAND_ERR_OUTPUT_DIR}"/gather-"${ceph_commands2[$i]}"-debug.log 2>&1 & | ||
pids_ceph+=($!) | ||
{ timeout 120 oc --kubeconfig="${KUBECONFIG}" -n "${ns}" exec "${TOOL_POD_NAME}" -- bash -c "${ceph_commands2[$i]} --connect-timeout=15 --format json-pretty" >>"${JSON_COMMAND_OUTPUT_FILE}"; } >>"${COMMAND_ERR_OUTPUT_DIR}"/gather-"${ceph_commands2[$i]}"-json-debug.log 2>&1 & | ||
pids_ceph+=($!) | ||
done | ||
|
||
# Check if PID array has any values, if so, wait for them to finish | ||
if [ ${#pids[@]} -ne 0 ]; then | ||
echo "Waiting on subprocesses to finish execution." | ||
wait "${pids[@]}" | ||
fi |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if Docker_files is right folder. I think we should move it or create other one as it's not related to any docker file or so.