ZABBIX Forums  

Go Back   ZABBIX Forums > Zabbix Discussions and Feedback > Zabbix Cookbook

Reply
 
Thread Tools Display Modes
  #1  
Old 24-05-2011, 15:08
mcree mcree is offline
Junior Member
 
Join Date: Apr 2008
Posts: 1
Post Monitoring LSI / Symbios MegaRAID SAS raid controller (found in several Dell servers)

Hello fellow zabbixers!

I thought that it would be nice to get notified about raid disk failures by zabbix, so I've put together a small bash script to generate monitoring XML templates for LSI and Symbios MegaRAID controllers using the MegaCli executable downloadable from www.lsi.com.

You should run the script on the host to be monitored since it only generates template items and notification triggers for existing drives. You must set the path to the MegaCli executable in the header of the script, then run it like:

Code:
bash confgen_zabbix_megacli.sh > megaraid_template.xml
On success you should see something like:
xml
Code:
+ detecting adapters
+ found 1 adapter(s)
+ examining adapter 0
+ found disk: 32:0
+ found disk: 32:1
+ found disk: 32:2
+ done
And of course the file 'megaraid_template.xml' would contain the template generated for your configuration.

Don't forget to add the following line to your zabbix_agentd.conf and restart your agent:

Code:
UserParameter=megaraid[*],sudo $CMD -pdInfo -PhysDrv[$2:$3] -a$1 | grep '$4' | cut -f2 -d':' | cut -b2-
Where $CMD is the path to your copy of MegaCli executable. Also consider that the command above presumes that the user running your agent is permitted to use 'sudo' (eg.: the zabbix user is in the sudoers file).

Cheers:
Erno Rigo
http://rigo.info
Attached Files
File Type: zip templategen_zabbix_megaraid.zip (2.0 KB, 1980 views)
Reply With Quote
  #2  
Old 22-06-2011, 02:48
wdingus wdingus is offline
Junior Member
 
Join Date: Dec 2007
Posts: 7
Default

It's always interesting to see how someone else solved the same problem I did... Yours is more elegant but this works for us.

We have some servers with 32-bit OS installs and some with 64-bit. So I tried to make this universal and able to work on either. A zero returned is good, anything non-zero means an error of some kind. Could be an actual RAID error or a problem with the command. So a simple trigger to alert on non-zero values.

system.run[(/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL 2>&1 || /opt/MegaRAID/MegaCli/MegaCli -LDInfo -Lall -aALL 2>&1) | grep -i 'State\|Permission' | grep -v Optimal | wc -l]
Reply With Quote
  #3  
Old 14-11-2012, 18:53
tttodorov tttodorov is offline
Junior Member
 
Join Date: Oct 2012
Location: Sofia, Bulgaria
Posts: 5
Send a message via Skype™ to tttodorov
Question

Thanks, mcree, wdingus, for the solutions!

wdingus, I have a question on your solution:
I have never seen a failed Drive with MegaCli. In normal condition the MegaCli state is:
# ---
...
State : Optimal
...
# ---
, but what MegaCLI says in failing state?
My thoughts are: if in failing state it says "Not Optimal", then your command "... | grep -v Optimal" will not detect the error. Have you ever tested your commands on failing environment?

Thanks again,
Todor

Quote:
Originally Posted by wdingus View Post
It's always interesting to see how someone else solved the same problem I did... Yours is more elegant but this works for us.

We have some servers with 32-bit OS installs and some with 64-bit. So I tried to make this universal and able to work on either. A zero returned is good, anything non-zero means an error of some kind. Could be an actual RAID error or a problem with the command. So a simple trigger to alert on non-zero values.

system.run[(/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL 2>&1 || /opt/MegaRAID/MegaCli/MegaCli -LDInfo -Lall -aALL 2>&1) | grep -i 'State\|Permission' | grep -v Optimal | wc -l]
Reply With Quote
  #4  
Old 15-11-2012, 20:40
wdingus wdingus is offline
Junior Member
 
Join Date: Dec 2007
Posts: 7
Default

Good question... I'm pretty sure we have had success with this monitor, alerting us to failures. I don't have a specific example handy. How about looking into the possibilities this way though:

# strings /opt/MegaRAID/MegaCli/MegaCli64 | grep Optimal -B3
Offline
Partially Degraded
Degraded
Optimal

Looks like those are the 4 possible values following State: so the "grep -v Optimal" would hopefully be fine. We're just interested in being alerted to *anything* other than Optimal, human eyes can investigate further.
Reply With Quote
  #5  
Old 15-11-2012, 20:50
tttodorov tttodorov is offline
Junior Member
 
Join Date: Oct 2012
Location: Sofia, Bulgaria
Posts: 5
Send a message via Skype™ to tttodorov
Wink

Yes, you are right about the "strings". These should be the possible values.
I like the solution and particularly the simplicity. Of course, one should be interested in *any* change in the RAID status and any change should be investigated. I am implementing this in our environment.
Thanks a lot,
Todor
Reply With Quote
  #6  
Old 20-11-2012, 00:17
geek74 geek74 is offline
Junior Member
 
Join Date: Aug 2012
Posts: 9
Default

Hi,

To monitor the hardware of my dell servers under Ubuntu I am using OMSA to populate snmp with all the hardware info. So no need sudo access with the zabbix agent, no need to add user parameter in agent config

If you want I can share my Dell R720 snmp template Tomorrow.

Cheers.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:21.