Monitor HP server RAID in Linux

Here's a quick hack to add basic RAID checking with email alerts into your HP Server on Centos 7. This will allow you to receive email alerts when your RAID status is not OK. We're assuming you already installed Centos using the official HP RAID driver and are using your inbuilt HP RAID controller. We also assume your system is able to send emails using the mail command. This is tested and working on HP Microserver Gen8 and HP DL80 Gen9 but should work for any HP server which supports hpssacli.

wget http://downloads.linux.hpe.com/SDR/repo/mcp/centos/7/x86_64/current/hpss...
yum install mailx hpssacli*

vim /opt/checkRaid.pl

and paste the below code, then save. In our example we expect 5 lines containing "OK". Your RAID could be different so use "hpssacli ctrl all show config" to to find out how many lines containing the work "OK" are normal for your setup then adjust the number in the code below accordingly.

#!/usr/bin/perl
my $result=`hpssacli ctrl all show config`;
if(`echo "$result"|grep OK|wc -l`!=5){
`echo "$result" | mail -s 'Bedale RAID Failure'
youremail\@here.com`;}

chmod +x /opt/checkRaid.pl

crontab -e
*/30 * * * * /opt/checkRaid.pl

Done! Your server will now email you when your RAID status is not OK.As you can see above, the cron check happens every 30 mins but you can adjust it to suit. There is plenty of potential to make this more clever, but it's a good starting point. Next we'll show you how to use this within a nagios/icinga environment.

IT Support Contracts

Support contracts to cover all your IT and Telecoms with UK wide free call-out. Our friendly support staff provide on-site, telephone, email and remote support for workstations, servers and phone systems. We offer full Linux support as well as Apple and Microsoft.

 

Linux Business Servers

Linux servers to suit every requirement from drop-in Microsoft replacements to advanced firewalls, high availability, thin client servers and virtualisation. Our SME Business Server product provides your business with an IT solution taking care of networking, security, storage, email, backup, remote access and much more.

 

Distro Support Includes

  • Elastix / Issabel / FreePBX
  • RedHat / CentOS / Scientific
  • Koozali / smeserver / SUSE
  • Solaris / Unux / BSD
  • Debian / Ubuntu / Linux Mint
  • Arch / Archbang / Gentoo
  • Fedora / Kubuntu / Xubuntu
  • Raspbian / Embedded Systems

Ubuntu Server & Desktop

Pre-configured Ubuntu server, desktop and thin client systems to suit your requirements. We offer drop-in Microsoft Server replacements and even migrate your existing Microsoft server or desktops and keep the applications you need.