Friday, November 13, 2015

[FreeNAS Alert]: Setting up FreeNAS to alert for Raid Failure via e-mail.

Setting up FreeNAS to alert for Raid Failure via e-mail.


The scope of this script is to check the disk status on schedule and to send a SMS(like) e-mail to sysadmin only if Only if something is MISSING.

Now everything you need is on one file, using the PHPMailer code implemented on FreeNAS .
The image below shows you the information’s that you have to change in order to make the script working for you.





Once you finish customizing the script with your email configuration, you have to set a “cron job”(scheduled task) to check the disks status at predetermined time.

The image below shows an example for a “cron job” scheduled to run every hour at 10 minutes after hour. 





An example (old) of the script in action. 
As you can see the script collect only important information, the host name (computer name, test250.mod in this example), and the disk status(ONLINE in this example, was running in test mode(old style, now even the test-mode will show MISSING)), date and time.



Download emailalert_2.1.tgz

Or from FreeNAS shell:
#fetch http://www.freenaskb.info/kb_upload/File/scripts/emailalert_2.1.tgz
#tar xzf emailalert_2.1.tgz
#nano emailalert.php

No comments: