iostat -En 输出格式

iostat -En 输出格式

当我使用“iostat -En”命令提取 Solaris 8 SPARC 上的设备名称时,我遇到问题,因为设备名称太长。

例如

iostat -en output

---- errors ---
s/w h/w trn tot
0 1 0 1 c6t50060E8005BDEC37d124


iostat –En ouput

c6t50060E8005BDESoft Errors: 0 Hard Errors: 1 Transport Errors: 0
Vendor: HP Product: OPEN-V -SUN Revision: 6005 Serial No: 50 0BDEC01D2
Size: 36.20GB <36203397120 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 1 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0

当我使用时iostat -En正如你所看到的c6t50060E8005BDEC37d124已经成为了c6t50060E8005BDESoft

我该如何格式化它以如下所示的方式显示:

c6t50060E8005BDEC37d124 Soft Errors: 0 Hard Errors: 1 Transport Errors: 0
Vendor: HP Product: OPEN-V -SUN Revision: 6005 Serial No: 50 0BDEC01D2
Size: 36.20GB <36203397120 bytes>

Media Error: 0 Device Not Ready: 0 No Device: 1 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0

我想使用-E选项,因为我需要检查“产品”值,请不要建议使用-en

答案1

要获取可解析的产品字符串,您可以使用kstat -c device_error。要将结果与c*t*d*值匹配,请获取其节点名称/etc/path_to_inst并查看目录中指向它的链接/dev/dsk

例如:

# kstat -c device_error
...
module: cmdkerror                       instance: 2     
name:   cmdk2,error                     class:    device_error
        crtime                          51.900857015
        Device Not Ready                0
        Hard Errors                     0
        Illegal Request                 0
        Media Error                     0
        Model                           Maxtor 6Y160M0 
        No Device                       0
        Recoverable                     0
        Revision                        
        Serial No                       Y41Y9W9E       
        Size                            163928604672
        snaptime                        68987.182338653
        Soft Errors                     0
        Transport Errors                0
...
$ grep '2 "cmdk"' /etc/path_to_inst
"/pci@0,0/pci-ide@12/ide@0/cmdk@0,0" 2 "cmdk"
$ ls -l /dev/dsk | grep '/pci@0,0/pci-ide@12/ide@0/cmdk@0,0' | head -1
lrwxrwxrwx   1 root     root          49 Sep 20  2010 c7d0p0 -> ../../devices/pci@0,0/pci-ide@12/ide@0/cmdk@0,0:q

相关内容