Enabling smartd in regular pfsense
-
Necessary disclaimer: Don't blame me if stuff blows up, or doesn't work as expected. This is being tested on a production system I'm running, the rc (automatic start during boot) has not being tested yet.
Guide:
-
Diagnostics > Command prompt:
cp /etc/rc /etc/rc.original -
Diagnostics > Edit file:
Enter /etc/rc in the box and hit Load.
Find the lines that say:
# Start packages /etc/rc.start_packages /bin/rm -rf /usr/local/pkg/pf/CVS
Add below them:
# Customization echo -n 'Starting custom applications:' echo -n ' smartd'; /usr/local/sbin/smartd -p /var/run/smartd.pid echo '.'
- Diagnostics > Edit file:
Enter /usr/local/etc/smartd.conf in the box, hit Load. It might say the file doesn't exist, ignore it.
Enter your parameters in the file, for example mine is:
/dev/ad0 -S on -o on -H -a /dev/ad2 -S on -o on -H -a
If you already have email notifications working:
/dev/ad0 -S on -o on -H -a -m email@example-domain.com /dev/ad0 -S on -o on -H -a -m email@example-domain.com
Hit save.
-
Diagnostics > Command prompt:
/usr/local/sbin/smartd -p /var/run/smartd.pid -
This should show up in your logs:
Nov 28 09:13:19 smartd[80006]: file /var/run/smartd.pid written containing PID 80006 Nov 28 09:13:19 smartd[80006]: smartd has fork()ed into background mode. New PID=80006. Nov 28 09:13:18 smartd[79726]: Monitoring 2 ATA and 0 SCSI devices Nov 28 09:13:18 smartd[79726]: Device: /dev/ad2, is SMART capable. Adding to "monitor" list. Nov 28 09:13:18 smartd[79726]: Device: /dev/ad2, enabled SMART Automatic Offline Testing. Nov 28 09:13:18 smartd[79726]: Device: /dev/ad2, enabled SMART Attribute Autosave. Nov 28 09:13:18 smartd[79726]: Device: /dev/ad2, not found in smartd database. Nov 28 09:13:18 smartd[79726]: Device: /dev/ad2, ST3402112AS, S/N:9LR1JQ6N, FW:3.BHL, 40.0 GB Nov 28 09:13:18 smartd[79726]: Device: /dev/ad2, opened Nov 28 09:13:18 smartd[79726]: Device: /dev/ad0, is SMART capable. Adding to "monitor" list. Nov 28 09:13:18 smartd[79726]: Device: /dev/ad0, enabled SMART Automatic Offline Testing. Nov 28 09:13:18 smartd[79726]: Device: /dev/ad0, enabled SMART Attribute Autosave. Nov 28 09:13:18 smartd[79726]: Device: /dev/ad0, not found in smartd database. Nov 28 09:13:18 smartd[79726]: Device: /dev/ad0, ST3402112AS, S/N:5LRARDPW, FW:3.BHL, 40.0 GB Nov 28 09:13:18 smartd[79726]: Device: /dev/ad0, opened Nov 28 09:13:18 smartd[79726]: Configuration file /usr/local/etc/smartd.conf parsed. Nov 28 09:13:18 smartd[79726]: Opened configuration file /usr/local/etc/smartd.conf Nov 28 09:13:18 smartd[79726]: Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org Nov 28 09:13:18 smartd[79726]: smartd 6.1 2013-03-16 r3800 [FreeBSD 8.3-RELEASE-p11 i386] (local build)
If you already have remote syslog enabled and working, the logs will show up on the remote server immediately.
If anyone has any ideas on how to get smartd to show up on Status > services, please share.
Edit:
Half an hour later, after starting a long test on one disk:Nov 28 09:43:19 smartd[80006]: Device: /dev/ad0, self-test in progress, 50% remaining Nov 28 09:43:19 smartd[80006]: Device: /dev/ad0, SMART Usage Attribute: 195 Hardware_ECC_Recovered changed from 46 to 47 Nov 28 09:43:19 smartd[80006]: Device: /dev/ad0, SMART Usage Attribute: 194 Temperature_Celsius changed from 33 to 35 Nov 28 09:43:19 smartd[80006]: Device: /dev/ad0, SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 67 to 65
Showed up on the remote syslog as well. So far so good.
-
-
Update: Tested the automatic start up today. Works as expected.
-
I realize that I'm raising this from the dead but anyway...
Sending mail from
smartd
currently is not working as it complains about missing mail executable:Jul 16 15:07:58 smartd 56729 Test of <mail> to ***@*** produced unexpected output (22 bytes) to STDOUT/STDERR: Jul 16 15:07:58 smartd 56729 exec: mail: not found
Is there a workaround for this. And is there a better way to monitor and report errors on your pfsense storage. My old hdd just failed that's why I'm trying to make my new pfsense a little bit more resilient.
Also the file needed to be changed is currently not
/etc/rc
but/etc/pfSense-rc
. -
i would suggest to not modify core files of pfsense, the best solution would be to create a script inside /usr/local/etc/rc.d with what you need, this is a really old topic, alot of thing had change since then.
there is Zabbix available in System / Package Manager / Available Packages -
Thanks, for the response. I'll do that. Still is there a simple way for smard to send mail from pfsense? I believe it uses mail but probably would also work with sendmail. Also I've installed zabbix but there are no settings about disk health. And I don't really need complicated full blown system monitoring just checking my disk health and send me mail when the drive starts failing. It's easily done by the smartd demon without the extra complication.
-
https://docs.netgate.com/pfsense/en/latest/packages/installing-freebsd-packages.html
"These packages are not supported by the pfSense development team. They may break the firewall, be careful!"
for 2.4.4 64bit should be
pkg add http://pkg.freebsd.org/FreeBSD:11:amd64/latest/All/cyrus-sasl-saslauthd-2.1.27_1.txz
pkg add http://pkg.freebsd.org/FreeBSD:11:amd64/latest/All/sendmail+tls+sasl2-8.15.2_18.txzplus all other dependency that it ask
-
Great. Thanks a lot
-
Don't install an MTA on the firewall.
If you install the arpwatch package, it comes with a small script which pretends to be sendmail so it can send mail using the pfSense notification settings.