email SMART attributes

    • OMV 2.x
    • email SMART attributes

      Hello all,

      Currently I log on my OMV once in a while just to take a look at the SMART attributes of my disks (not talking about tests, just look at information like 5 (reallocated sectors count), 7, 196, 197 etc).

      Is there a way to automate this so my OMV would send me an email every day for example with these values ? Again I do not want to do selftests etc, just a quick peek at the SMART values.

      Also, why is there no 187 and 188 (reported uncorrectable errors and command timeout) ?

      Thanks
    • No, that's not possible.

      The attributes are missing because the smart database does not know about them for your device or your device does not support them.
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • Hecatonchyr wrote:

      Is there a way to automate this so my OMV would send me an email every day for example with these values ?
      You can write a small script which is writing the SMART values in a files and sends you the file by e-mail. You can run the script as scheduled job.
      Something like this:

      Shell-Script

      1. #!/bin/bash
      2. #
      3. # Place this in /bin/
      4. # Call: sh /bin/sendsmart.sh
      5. (
      6. echo "To: your@emailadress.com"
      7. echo "Subject: SMART Results for all drives"
      8. echo " "
      9. ) > /var/cover
      10. smartctl -i -H -A -l error /dev/sda >> /var/cover
      11. smartctl -i -H -A -l error /dev/sdb >> /var/cover
      12. smartctl -i -H -A -l error /dev/sdc >> /var/cover
      13. sendmail -t < /var/cover
      14. exit 0
      15. # Options -n standby
      16. # -i = Device Info
      17. # -H = Device Health
      18. # -A = Only Vendor specific SMART attributes
      19. # -l error = SMART Error Log
      Display All
      Odroid HC2 - armbian - Seagate ST4000DM004 - OMV4.x
      Asrock Q1900DC-ITX - 16GB - 2x Seagate ST3000VN000 - Intenso SSD 120GB - OMV4.x
      :!: Backup - Solutions to common problems - OMV setup videos - OMV4 Documentation - user guide :!:
    • Please, sane temp file handling and no hardcoded device paths :)

      Shell-Script

      1. #!/bin/bash
      2. #
      3. # Place this in /bin/
      4. # Call: sh /bin/sendsmart.sh
      5. TempFile=$(mktemp /tmp/${0##*/}.XXXXXX)
      6. trap "rm -f \"${TempFile}\" ; exit 0" 0 1 2 3 15
      7. (
      8. echo "To: your@emailadress.com"
      9. echo "Subject: SMART Results for all drives"
      10. echo " "
      11. ) > ${TempFile}
      12. for disk in /dev/sd? ; do
      13. smartctl -i -H -A -l error ${disk} >> ${TempFile}
      14. done
      15. sendmail -t < ${TempFile}
      16. exit 0
      17. # Options -n standby
      18. # -i = Device Info
      19. # -H = Device Health
      20. # -A = Only Vendor specific SMART attributes
      21. # -l error = SMART Error Log
      Display All
    • Hey, I am happy to get around with the simple stuff without making too many mistakes. And now you ... :)

      What's wrong with hardcoded paths? Conflict because they already exist or can not be created?
      Odroid HC2 - armbian - Seagate ST4000DM004 - OMV4.x
      Asrock Q1900DC-ITX - 16GB - 2x Seagate ST3000VN000 - Intenso SSD 120GB - OMV4.x
      :!: Backup - Solutions to common problems - OMV setup videos - OMV4 Documentation - user guide :!:
    • macom wrote:

      What's wrong with hardcoded paths?

      They can change. If you're interested in SMART data from every connected disk then simply query every connected disk (using the /dev/sd? regex in Linux). Hardcoded paths are always wrong especially in some scripts or cron jobs. You add a disk, forget to adjust all the paths here and there, feel save since 'monitoring active' and then hell breaks loose and you realize problems with your disk only since it failed.

      At one former customer they configured paths to be backed up in a hard coded way. Then something changed and the share containing the most recent data wasn't covered any more. Since the IT department outsourced everything to IBM they didn't test restores and then they rolled out a nice script that started to recursively delete all the share's contents in certain situations. Guess how surprised they were realizing that the entire media production of a whole month (9555 product images they needed for all advertisements accross Europe -- this agency did/does everything for both MediaMarkt and Saturn) was simply lost.

      TL;DR: don't use hard coded paths ;)
    • Use predictable device files that do not change.
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • Awesome ! It works flawlessly I created the script with nano and used mv to move it to bin, I added it in my scheduled jobs to run every week that's perfect thanks !

      When I checked the smart errors I only had some (about 15) on my system drive, and all were ABRT; it seems that each time I go look at this drive attributes it records that error because I checked the tab 4 times today and it reported 4 errors, each at the time I checked. Drive otherwise does not show any other problem (raw values for 5, 7, 196, 197, 198, 199 are all 0).