Check your Esxi-server for broken raid(s)/disks

Published by TheBlogger on

On the internet you can find information on many sites about how to send an email from your Esxi-server when something’s broken on your raid. Most of them apply to HP-servers, but the same goes when running other branded servers. They all rely on your Esxi-server being able to run a command, generate a textfile with the raid-configuration in it (showing the status of your raids/disks), and comparing this to a previous (OK-)version of that same file.

On HP-servers (since Esxi 6.0) the command used for getting information about your raids is “/opt/smartstorageadmin/ssacli/bin/ssacli controller all show config”

If you have a different branded server, that won’t have to be a problem, just as long as you can generate a textfile showing your running raid-configuration it’s OK, you can use that command in the script.

So, is anything wrong with using the provided information on those websites?

Well, depends on your needs/skills. When using the provided scripts without modifications, most of the times these scripts don’t work. Mails don’t get sent out because the command used for it (nc/netcat) is stuck after the initial connection, or mails DO get send, but are empty after receiving. All these scripts rely on just 1 way of generating a file, and just 1 way of sending an email (which for many configurations isn’t working).

Here’s a (HP-Server based) script that has 3 different versions in it for generating the mailtext, followed by 2 versions of a way to get the email REALLY send out. Just look at the file (it’s self-explanatory), and comment out the versions that don’t work on your system (or remove them, whatever you want) to get informed about the status of our raid(s). Put the script in a folder (I prefere /opt/localapps, path is also hardcoded in script), make it executable (chmod +x scriptfilename), TEST IT, add it to a cron-job, and you’re done.

Don’t forget to also enable your outgoing mail-port on your server, otherwise mails won’t get send at all.

Here you can find an XML-file for opening a SMTP-port on Esxi (just in case you don’t have it already). Copy this file to the /etc/vmware/firewall-folder, run the command “esxcli network firewall ruleset set –enabled=true –ruleset-id=SMTPout-25” (I use port 25 for SMTP, and have called it SMTPout-25), and your SMTP-port is open (outbound).

Happy Raiding . . .

Categories: Esxi-Server