Skip to content

Commit

Permalink
add support to check status of multiple Virtual Disks and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
neidiom committed Oct 29, 2017
1 parent 3b5b315 commit bf33a68
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
33 changes: 17 additions & 16 deletions lib/servermonitor/megacli_vd_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,24 @@ def self.run
raid_status.each_line { |l| in_in << l.chomp }

# Check virtual drive status
in_in.each { |i| Regexp.new('State\s*:\s*Optimal').match?(i) ? vd_status = "Optimal".upcase : vd_status = "NOT Optimal".upcase }
in_in.each do |i|
Regexp.new('State\s*:\s*Optimal').match?(i) ? vd_status = "Optimal".upcase : vd_status = "NOT Optimal".upcase

# Display VD Status
if vd_status == "Optimal"
puts "Virtual drive status is " + vd_status.to_s + " on hostname " + fhostname
puts exit 0 unless self.config.exit_codes == false
else
puts "Virtual drive status is " + vd_status.to_s + " on hostname " + fhostname
puts exit 1 unless self.config.exit_codes == false
end

if self.config.email_to != nil
time = Time.now.strftime("%d.%m.%Y %H:%M")
subject = "Daily RAID check STARTED on #{fhostname} at #{time}. RAID STATE: #{vd_status}."
body = "Daily RAID check: #{vd_status}"
email = ServerMonitor::EMail.new(self.config.email_from, self.config.email_to, self.config.smtp_address, self.config.smtp_port, self.config.smtp_username, self.config.smtp_password, subject, body)
email.deliver
# Display VD Status
if vd_status == "Optimal"
puts "Virtual drive status is " + vd_status.to_s + " on hostname " + fhostname
puts exit 0 unless self.config.exit_codes == false
else
puts "Virtual drive status is " + vd_status.to_s + " on hostname " + fhostname
puts exit 1 unless self.config.exit_codes == false
end
if self.config.email_to != nil
time = Time.now.strftime("%d.%m.%Y %H:%M")
subject = "Daily RAID check STARTED on #{fhostname} at #{time}. RAID STATE: #{vd_status}."
body = "Daily RAID check: #{vd_status}"
email = ServerMonitor::EMail.new(self.config.email_from, self.config.email_to, self.config.smtp_address, self.config.smtp_port, self.config.smtp_username, self.config.smtp_password, subject, body)
email.deliver
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/servermonitor/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ServerMonitor
VERSION = "0.1.1.3"
VERSION = "0.1.2"
end

0 comments on commit bf33a68

Please sign in to comment.