Created
January 18, 2012 20:29
-
-
Save delagoya/1635346 to your computer and use it in GitHub Desktop.
Emailing reports about bad drive from Promise Pegasus
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
$ promiseutil -C phydrv | |
=============================================================================== | |
PdId Model Type Capacity Location OpStatus ConfigStatus | |
=============================================================================== | |
1 Hitachi HDS7 SATA HDD 2TB Encl1 Slot1 OK Array0 Seq. No.0 | |
2 Hitachi HDS7 SATA HDD 2TB Encl1 Slot2 OK Array0 Seq. No.1 | |
3 Hitachi HDS7 SATA HDD 2TB Encl1 Slot3 OK Array0 Seq. No.2 | |
4 Hitachi HDS7 SATA HDD 2TB Encl1 Slot4 OK Array0 Seq. No.3 | |
5 Hitachi HDS7 SATA HDD 2TB Encl1 Slot5 OK Array0 Seq. No.4 | |
6 Hitachi HDS7 SATA HDD 2TB Encl1 Slot6 OK Array0 Seq. No.5 |
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/env ruby | |
`promiseutil -C phydrv`.split(/\n/).each do |l| | |
next unless l =~ /^\d/ | |
unless l =~ /OK/ | |
# email a warning to the user | |
system "echo \"PEGASUS 1: BAD DRIVE \n\n #{l}\" | mail -s 'ERR: PEGASUS 1' [email protected]" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment