Skip to content

Instantly share code, notes, and snippets.

@delagoya
Created January 18, 2012 20:29
Show Gist options
  • Save delagoya/1635346 to your computer and use it in GitHub Desktop.
Save delagoya/1635346 to your computer and use it in GitHub Desktop.
Emailing reports about bad drive from Promise Pegasus
$ 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
#!/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