Monday, February 24, 2014

Dell PowerEdge, pfSense and RAID status monitoring using ports/pkg

The Dell PowerEdge is a thing of beauty. Not only can you find a second-hand one for next to nothing, but they are great for acting as load balancers, firewalls and routers. With the the right tools and enough expertise you can build systems that the big players sell for tens, or sometimes hundreds of thousands of dollars. All you need to have is a second-hand Dell PowerEdge, a few Intel NICs, the right open-source software and you're set.

So I have this Dell PowerEdge box that acts as a firewall, having pfSense 2.1 installed on it. How do we go about monitoring its RAID status? The answer is pretty straightforward; Install megacli on a virtual machine, create a package out of it, transfer it to our pfSense box and install.

a) Check your FreeBSD version on your webconfigurator dashboard and depending on whether you have the 32 or the 64-bit version of pfSense installed, download the right .iso from  http://ftp.freebsd.org/pub/FreeBSD/. For instance, I have pfSense 2.1, which is based on FreeBSD 8.1 and is 64-bit. Therefore, I downloaded this:  http://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/8.1/FreeBSD-8.1-RELEASE-amd64-livefs.iso.
b) Create a virtual machine on your local PC using your favourite virtualization solution. Make sure it's 32-bit if your pfSense is 32-bit or 64-bit if your pfSense is 64-bit.
c) Install using the downloaded .iso.
d) Install all available packages, we might need to use this method again in the future for other packages.
e) If FreeBSD installation throws an error about not being able to find your distribution in the available mirrors, that would be because it's an older one. Just choose ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/i386/ if you have a 32-bit system or ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/ if you have a 64-bit system as the URL of the FreeBSD distibution on the remote ftp site.
f) Time for the actual work:
freebsd# freebsd-update fetch
freebsd# freebsd-update install
freebsd# portsnap fetch
freebsd# portsnap extract
freebsd# portsnap fetch update
freebsd# cd /usr/ports/sysutils/megacli/
freebsd# make package-recursive
Creating bzip'd tar ball in '/usr/ports/sysutils/megacli/work/megacli-8.07.07.tbz'

g) Go to your pfSense Webconfigurator, System, Advanced, Admin Access and make sure "Enable Secure Shell" is checked.
h) Upload the created bzip'd tar ball to your pfSense using SFTP or SCP.
i) SSH to your pfSense box and choose 8 (shell).
j) I have uploaded the packed to the /root directory so:
[2.1-RELEASE][root@pfsense.mynetwork.net]/root(1): pkg_add /root/megacli-8.07.07.tbz
[2.1-RELEASE][root@pfsense.mynetwork.net]/root(2): pkg_info
bsdinstaller-2.0.2013.0911 BSD Installer mega-package
gettext-0.18.3      GNU gettext package
libiconv-1.14_1     A character set conversion library
megacli-8.07.07     SAS MegaRAID FreeBSD MegaCLI

k) Now, you can go to your pfSense webconfigurator: System, Packages, Available Packages and install "mailreport".
l) Then go to System, Advanced, Notifications and configure your mail server SMTP settings.
m) Finally, go to Status, Email Reports and create a new mail report.
n) Configure it, save it and then edit it so that it executes the /usr/local/sbin/MegaCli -LDInfo -Lall -aALL and the /usr/local/sbin/MegaCli -PDList -aALL commands.

Done! Now every day you'll get a status report for your firewall's disks!

Note 1: This method uses the deprecated ports/pkg method. I will describe the method required using the newer pkgng system in a future post.
Note 2: Megacli does not work with the older SAS 6/iR cards, you will need the mptutil package. The method is the same.

No comments:

Post a Comment