我拼凑了一个单线,因此我可以快速找到服务器上存在中等错误的任何驱动器。这就像这样:
/var/lib/einarc/tools/adaptec_arcconf/cli getlogs 1 device tabular | egrep 'serialNumber|mediumErrors|vendorID' | awk '{$2="";print}' | awk '/^vendorID WDC/{p=1}p' | grep -C1 'mediumErrors [1-9]'
虽然这在具有 Western Digital 驱动器的服务器上工作得非常好,但也有一些是 Seagate 的,因此,一个班轮不能在它们上工作,因为:
awk '/^vendorID WDC/{p=1}p'
两台服务器上表格日志的原始输出如下所示。
Western Digital:
driveErrorEntry
smartError ....................... false
vendorID ......................... LSI CORP
serialNumber .....................
wwn .............................. 41121562336217ea
deviceID(T:L) .................... 0(0:0)
productID ........................ SAS2X26
numParityErrors .................. 0
linkFailures ..................... 0
hwErrors ......................... 0
abortedCmds ...................... 10
mediumErrors ..................... 0
smartWarning ..................... 0
driveErrorEntry
smartError ....................... false
vendorID ......................... WDC
serialNumber ..................... WD-WCAW25942651
wwn .............................. 0000000000000000
deviceID(T:L) .................... 13(13:0)
希捷:
Controllers found: 1
ControllerLog
controllerID ..................... 0
type ............................. 0
time ............................. 1365801225
version .......................... 3
tableFull ........................ false
driveErrorEntry
smartError ....................... false
vendorID ......................... LSI CORP
serialNumber .....................
wwn .............................. 411313200032c06a
deviceID(T:L) .................... 0(0:0)
productID ........................ SAS2X26
numParityErrors .................. 0
linkFailures ..................... 0
hwErrors ......................... 0
abortedCmds ...................... 12
mediumErrors ..................... 0
smartWarning ..................... 0
我希望得到的输出如下:
serialNumber WD-WMAYP5242602
mediumErrors 457
vendorID WDC
serialNumber WD-WMAYP3262235
mediumErrors 2
我想确保我没有过滤掉重要信息,因为一台服务器没有 WDC 驱动器,但同时我也不想要任何不直接涉及硬盘驱动器的信息 - 即控制器无论安装哪种驱动器,都应忽略输出。
谁能建议一种可行的方法(在bash中)?