sh BrickStorOS基本健康和系统信息收集脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh BrickStorOS基本健康和系统信息收集脚本相关的知识,希望对你有一定的参考价值。

#!/bin/bash
# Copyright 2019 RackTop Systems Inc. and/or its affiliates.
# http://www.racktopsystems.com
#
# The methods and techniques utilized herein are considered TRADE SECRETS
# and/or CONFIDENTIAL unless otherwise noted. REPRODUCTION or DISTRIBUTION
# is FORBIDDEN, in whole and/or in part, except by express written permission
# of RackTop Systems.

PREFIX=$(bsradm -j smb|jq -r '.SystemSerial')
WORKDIR="/root/${PREFIX}.bundle"

mkdir -p "${WORKDIR}" 2>/dev/null || {
    printf "Error: failed to mkdir ${WORKDIR}" >&2
    exit 1
}

echo "*** TOP zpool TOP ***" >> "${WORKDIR}/${PREFIX}-pools.txt"
zpool list  >> "${WORKDIR}/${PREFIX}-pools.txt"
zpool status >> "${WORKDIR}/${PREFIX}-pools.txt"
echo "*** BOOTOM zpool BOTTOM ***" >> "${WORKDIR}/${PREFIX}-pools.txt"

echo "*** TOP iostat TOP ***" >> "${WORKDIR}/${PREFIX}-pools.txt"
iostat -en >> "${WORKDIR}/${PREFIX}-pools.txt"
echo "----" >> "${WORKDIR}/${PREFIX}-pools.txt"
iostat -En >> "${WORKDIR}/${PREFIX}-pools.txt"
echo "*** BOOTOM iostat BOTTOM ***" >> "${WORKDIR}/${PREFIX}-pools.txt"

echo "*** TOP diskinfo TOP ***" >> "${WORKDIR}/${PREFIX}-disks-shelves.txt"
rtdmgr -bmsr >> "${WORKDIR}/${PREFIX}-disks-shelves.txt"
echo "----"  >> "${WORKDIR}/${PREFIX}-disks-shelves.txt"
rtdmgr -E+ >> "${WORKDIR}/${PREFIX}-disks-shelves.txt"
# This one may not be present in all versions of OS, so make it optional
echo "----" >> "${WORKDIR}/${PREFIX}-disks-shelves.txt"
[ -x $(which hwadm) ] && hwadm ls a >> "${WORKDIR}/${PREFIX}-disks-shelves.txt"
echo "----" >> "${WORKDIR}/${PREFIX}-disks-shelves.txt"
[ -x $(which secadm) ] && secadm ls a >> "${WORKDIR}/${PREFIX}-disks-shelves.txt"
echo "*** BOTTOM diskinfo BOTTOM ***" >> "${WORKDIR}/${PREFIX}-disks-shelves.txt"

echo "*** TOP sysinfo TOP ***" >> "${WORKDIR}/${PREFIX}-system.txt"
bsradm smb >> "${WORKDIR}/${PREFIX}-system.txt"
echo "----" >> "${WORKDIR}/${PREFIX}-system.txt"
bsradm sysinfo >> "${WORKDIR}/${PREFIX}-system.txt"
echo "----" >> "${WORKDIR}/${PREFIX}-system.txt"
bsradm os >> "${WORKDIR}/${PREFIX}-system.txt"
echo "*** BOTTOM sysinfo BOTTOM ***" >> "${WORKDIR}/${PREFIX}-system.txt"

echo "*** TOP faults TOP ***" >> "${WORKDIR}/${PREFIX}-hw.txt"
fmadm faulty >> "${WORKDIR}/${PREFIX}-hw.txt"
echo "----" >> "${WORKDIR}/${PREFIX}-hw.txt"
svcs -xv >> "${WORKDIR}/${PREFIX}-hw.txt"
echo "*** BOTTOM faults BOTTOM ***" >> "${WORKDIR}/${PREFIX}-hw.txt"

echo "*** TOP chassis TOP ***" >> "${WORKDIR}/${PREFIX}-hw.txt"
echo "----" >> "${WORKDIR}/${PREFIX}-hw.txt"
ipmitool sel elist | tail -100 >> "${WORKDIR}/${PREFIX}-hw.txt"
echo "----" >> "${WORKDIR}/${PREFIX}-hw.txt"
ipmitool sdr >> "${WORKDIR}/${PREFIX}-hw.txt"
echo "*** BOTTOM chassis BOTTOM ***" >> "${WORKDIR}/${PREFIX}-hw.txt"

for sfx in pools.txt disks-shelves.txt system.txt hw.txt; do
    bzip2 -9 "${WORKDIR}/${PREFIX}-${sfx}"
done

printf "Thank you, please retrieve ${WORKDIR} directory.\n"

以上是关于sh BrickStorOS基本健康和系统信息收集脚本的主要内容,如果未能解决你的问题,请参考以下文章

sh BrickstorOS的容量,使用和配额

sh BrickstorOS启动池(bp)设置和修改

python BrickstorOS片段用于获取各种文件系统信息。

sh BrickStorOS配置调整脚本

sh 控制BrickstorOS上的活动核心

sh BrickstorOS安装程序