Created
October 15, 2012 16:43
-
-
Save gotnix/3893522 to your computer and use it in GitHub Desktop.
过滤MegaCli 输出的AWK 脚本
This file contains hidden or 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
| #!/usr/bin/awk -f | |
| ## 过滤MegaCli 输出的PD/VD信息,单行模式 | |
| # awk 'BEGIN { FS=": "; ME_PD=0 } /^Media Error/ { if ( $2 != 0 ) ++ME_PD } END { print "Media_Error_PD = ",ME_PD }' | |
| BEGIN { | |
| FS=": "; OFF_LIN=0; MedErr_PD=0; OthErr_PD=0; PreFail_PD=0; NonOpt_VD=0 | |
| } | |
| /^Firmware state:/ { if ( $2 != "Online" ) ++OFF_LIN } | |
| /^Media Error Count:/ { if ( $2 != 0 ) ++MedErr_PD } | |
| /^Other Error Count:/ { if ( $2 != 0 ) ++OthErr_PD } | |
| /^Predictive Failure Count:/{ if ( $2 != 0 ) ++PreFail_PD } | |
| /^State:/{ if ( $2 != "Optimal" ) ++NonOpt_VD } | |
| END { | |
| print "Firmware_Offline_PD =",OFF_LIN | |
| print "Media_Error_PD =",MedErr_PD | |
| print "Other_Error_PD =",OthErr_PD | |
| print "Predictive_Failure_PD =",PreFail_PD | |
| print "NonOptimal_VD =",NonOpt_VD | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment