Commit 9c8142bd by liyapeng

优化收集日志细节

1 parent 8e1c52ea
Showing with 7 additions and 1 deletions
......@@ -5,7 +5,7 @@ TMP_SECRET_ID=${COS_TMP_SECRET_ID}
TMP_SECRET_KEY=${COS_TMP_SECRET_KEY}
TMP_SESSION_TOKEN=${COS_TMP_SESSION_TOKEN}
BUCKET_NAME='log-collection-1310972338'
ENDPOINT='cos.ap-beijing.myqcloud.com'
ENDPOINT='cos.ap-nanjing.myqcloud.com'
CURRENT_DATE=$(date +%Y%m%d)
LOG_DIR="$(hostname)-${CURRENT_DATE}-log"
LOG_FILE_PATH="/tmp/${LOG_DIR}"
......@@ -79,6 +79,7 @@ GPULogCollect() {
lspci -vvv >>${LOG_FILE_PATH}/GPULogCollect/lspci-nvidia.log
dmesg -T >${LOG_FILE_PATH}/GPULogCollect/dmesg-gpu.log
journalctl | grep -i nvrm > journalctl_nvrm.txt
dmidecode -t slot > slot-all.txt
# get slot info
touch ${LOG_FILE_PATH}/GPULogCollect/slot-info.txt
nvidia-smi --query-gpu=index,gpu_name,gpu_bus_id,uuid --format=csv > ${LOG_FILE_PATH}/GPULogCollect/slot-info.txt
......@@ -104,6 +105,7 @@ sosreportLOG() {
sosreport --batch
fi
cp /tmp/sosreport* ${LOG_FILE_PATH}/
rm /tmp/sosreport*
}
Bundlinglogfiles() {
......@@ -113,7 +115,11 @@ Bundlinglogfiles() {
uploadlogfile() {
echo "upload log file"
chmod +x coscli
if [ -z "$TMP_SESSION_TOKEN" ]; then
./coscli -c ./.cos.yaml -e ${ENDPOINT} -i ${TMP_SECRET_ID} -k ${TMP_SECRET_KEY} cp /tmp/${LOG_DIR}.tar cos://${BUCKET_NAME}/${LOG_DIR}.tar
else
./coscli -c ./.cos.yaml -e ${ENDPOINT} -i ${TMP_SECRET_ID} -k ${TMP_SECRET_KEY} --token ${TMP_SESSION_TOKEN} cp /tmp/${LOG_DIR}.tar cos://${BUCKET_NAME}/${LOG_DIR}.tar
fi
}
main() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!