Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Enabling smartd in regular pfsense

    Scheduled Pinned Locked Moved pfSense Packages
    8 Posts 4 Posters 3.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User
      last edited by

      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:

      1. Diagnostics > Command prompt:
        cp /etc/rc /etc/rc.original

      2. 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 '.'
      
      1. 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.

      1. Diagnostics > Command prompt:
        /usr/local/sbin/smartd -p /var/run/smartd.pid

      2. 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.

      1 Reply Last reply Reply Quote 0
      • ?
        A Former User
        last edited by

        Update: Tested the automatic start up today. Works as expected.

        1 Reply Last reply Reply Quote 0
        • R
          rxa
          last edited by rxa

          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.

          1 Reply Last reply Reply Quote 0
          • kiokomanK
            kiokoman LAYER 8
            last edited by kiokoman

            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

            ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
            Please do not use chat/PM to ask for help
            we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
            Don't forget to Upvote with the 👍 button for any post you find to be helpful.

            1 Reply Last reply Reply Quote 1
            • R
              rxa
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • kiokomanK
                kiokoman LAYER 8
                last edited by kiokoman

                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.txz

                plus all other dependency that it ask

                ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
                Please do not use chat/PM to ask for help
                we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
                Don't forget to Upvote with the 👍 button for any post you find to be helpful.

                1 Reply Last reply Reply Quote 1
                • R
                  rxa
                  last edited by

                  Great. Thanks a lot

                  1 Reply Last reply Reply Quote 0
                  • jimpJ
                    jimp Rebel Alliance Developer Netgate
                    last edited by

                    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.

                    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                    Need help fast? Netgate Global Support!

                    Do not Chat/PM for help!

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.