Hi
Need to monitor the RAID Status of your Avago LSI Logic / Symbios Logic SAS3008 PCI-Express Fusion-MPT SAS-3 under Linux with perl?
Yes Avago has a crappy website. When you search the website for SAS3008 you only find some pdf. But not the utility to query your raid controller. Crappy website or intentionally. Who knows :-)
Below is a script which send’s a simple mail if something goes bad to your RAID. Just put it in your crontab. Might someone want’s to adopt it. Might use with Nagios/Icinga. Actually I’ve not the case to do this. Might later…
#!/usr/bin/perl use warnings; use MIME::Lite; $emailFrom = 'root@server.domain.tld'; $emailTo = 'hostmaster@yourdomain.tpl'; $smartHost = 'smarthost.mail.local'; $hostName = 'server.domain.tld'; $pathSas3ircu = '/root/bin/SAS3IRCU_P12/sas3ircu_linux_x64_rel/sas3ircu'; if (check_status() == 1) { $body = join("", get_info("0","STATUS")); send_email($emailTo,$body); } sub check_status { $error = 0; foreach $line (get_info("0","DISPLAY")) { if ($line =~ /Status of volume/) { if ($line !~/Okay/) { $error = 1; } } if ($line =~ /State/) { if ($line !~ /Optimal/ ) { $error = 1; } } } return $error; } sub get_info { $arg1 = shift; $arg2 = shift; $cmd = "$pathSas3ircu $arg1 $arg2"; @output = `$cmd`; return @output; } sub send_email { $arg1 = shift; $arg2 = shift; $subject = "Warning RAID inconsitent $hostName"; $msg = MIME::Lite->new( From => $emailFrom, To => $arg1, Subject => $subject, Data => $arg2 ); $msg->send('smtp',$smartHost,Debug=>0); }
Here a download link of the tool:
http://docs.avagotech.com/docs/SAS3IRCU_P12.zip
Here a link of an different controller where you find the download link:
http://www.avagotech.com/products/server-storage/host-bus-adapters/sas-9305-16e#downloads
EDIT 16.05.2018:
TomD kindly provided a simple nagios script:
#!/bin/bash status=$(sas3ircu 0 STATUS | grep -o 'Optimal') status1=$(sas3ircu 0 DISPLAY | grep -o 'OKY') if [ "$status" = "Optimal" ] then if [ "$status1" = "OKY" ] then echo OK raid is good exit 0 fi else echo Warn raid failed exit 1 fi echo Critical raid failed exit 3
Have Fun!