bin/check-raid.rb in sensu-plugins-raid-checks-2.0.3 vs bin/check-raid.rb in sensu-plugins-raid-checks-3.0.0
- old
+ new
@@ -40,13 +40,15 @@
default: false
# Check software raid
#
def check_software_raid
return unless File.exist?('/proc/mdstat')
+
contents = File.read('/proc/mdstat')
mg = contents.lines.grep(/active|blocks/)
return if mg.empty?
+
sg = mg.to_s.lines.grep(/\]\(F\)|[\[U]_/)
if sg.empty?
ok 'Software RAID OK'
else
warning 'Software RAID warning'
@@ -55,10 +57,11 @@
# Check HP raid
#
def check_hp
return unless File.exist?('/usr/bin/cciss_vol_status')
+
contents = `/usr/bin/cciss_vol_status /dev/sg0`
c = contents.lines.grep(/status\: OK\./)
# #YELLOW
if c.empty?
warning 'HP RAID warning'
@@ -69,10 +72,11 @@
# Check Adaptec raid controllers
#
def check_adaptec
return unless File.exist?('/usr/StorMan/arcconf')
+
contents = `/usr/StorMan/arcconf GETCONFIG 1 AL`
mg = contents.lines.grep(/Controller Status/)
# #YELLOW
if mg.empty?
@@ -105,9 +109,10 @@
# Check Megaraid
#
def check_mega_raid
return unless File.exist?('/usr/sbin/megacli')
+
contents = if config[:log]
`/usr/sbin/megacli -AdpAllInfo -aALL`
else
`/usr/sbin/megacli -AdpAllInfo -aALL -NoLog`
end