[mythtv-users] Can't get storage priorities correctly.
David Watkins
watkinshome at gmail.com
Mon Nov 20 08:45:03 UTC 2023
On Sat, 18 Nov 2023 at 12:27, Stephen Worthington <stephen_agent at jsw.gen.nz>
wrote:
> On Sat, 18 Nov 2023 10:15:34 +0000, you wrote:
>
> >Hi Stephen,
> >
> >I know that in the past you've shared some of your useful scripts and
> >wondered if you had anything to share which would help with automating the
> >smartctl reporting.
> >
> >I've been running it manually every few weeks (except when I forget) and
> >I've caught a couple of failing drives with it - and missed one.
> >
> >The bit I'm most unsure of is how to automatically interpret the results
> >and convert them to a warning, particularly as some of my drives report
> >some strange numbers in some of the checks, which I think can probably be
> >ignored.
> >
> >I generally just go by whether the short test completes successfully but I
> >think I should be checking whether some of the failure counts are going
> up?
> >
> >Thanks
>
> SmartMonTools already includes code to check for problems with the
> drive - so all you need to do is install and configure it correctly.
> Then smartd will run in the background all the time and notify you of
> anything you need to know about. Look at the /etc/smartd.conf file
> and adjust it so that it emails you on any error. I had to also
> customise it to tell it the type of some drives (such as the fact that
> my archive drives are "removable" (they are normally turned off and
> are only on when I want to watch a recording on one of them). So I
> commented out the default DEVICESCAN line, and replace it with this:
>
> #DEVICESCAN -d removable -n standby -m root -M exec
> /usr/share/smartmontools/smartd-runner
> DEFAULT -a -n standby -m root -M exec
> /usr/share/smartmontools/smartd-runner
> /dev/nvme0n1 -d nvme
> /dev/disk/by-label/arc1 -d sat,16 -d removable
> /dev/disk/by-label/arc2 -d sat,16 -d removable
> /dev/disk/by-label/arc3 -d sat,16 -d removable
> /dev/disk/by-label/arc4 -d sat,16 -d removable
> /dev/disk/by-label/arc5 -d sat,16 -d removable
> /dev/disk/by-label/arc6 -d sat,16 -d removable
> DEVICESCAN -a -d auto -d removable -n standby
> #DEVICESCAN -a -m stephen at jsw.gen.nz -M test
> DEVICESCAN -a -m stephen at jsw.gen.nz -M daily
>
> (My email client wrapped the first #DEVICESCAN line and the DEFAULT
> line under it - they are each one line only)
>
> It was a long time ago that I did this, so I can not remember the full
> details of each option, but the /dev lines just describe drives that
> smartd was not looking at automatically, or was using the wrong
> options for. You do not need them unless there are problems with the
> default settings. The DEFAULT and DEVICESCAN lines tell smartd what
> to do. The "-a" on a DEVICESCAN line tells it to scan all the drives
> it can find. See "man smartd.conf" for full details. I have it set
> up to run the smartd-runner program, which then pops up an XFCE4
> on-screen message and also emails me on the root account on that
> machine and also on my main email and my gmail accounts. The idea is
> that I should see one of those messages as soon as possible so I can
> do something about a potential failing drive. To make all that work,
> I think you need to install the smart-notifier package, and also a
> mail program to send emails with, from either the bsd-mailx package or
> mailutils package. The mail program needs to be configured to be able
> to send emails via your normal SMTP server. I do not know how to
> configure it to send via gmail, as I run my own SMTP server which can
> send to gmail for me and I just send any emails to it to handle. You
> could just try configuring smartd to send to your @gmail.com address
> and mail might be smart enough to do it automatically. I have MX
> records defined in my DNS for my jsw.gen.nz domain, and it finds them
> and sends to my main stephen at jsw.gen.nz account without any further
> configuration. I have mailutils installed - I think that is all that
> is needed to make the local email accounts work on a Linux system, so
> that emails to addresses like root at localhost will work and can be
> accessed by running "mail" from the root account, or from any other
> account for the messages for that account.
>
> To get smartd to run, you need to edit /etc/default/smartmontools and
> set "start_smartd=yes", then run:
>
> sudo systemctl enable --now smartmontools
>
> The commented out -M test line is used for testing if email addresses
> work. Comment out your -M daily line and uncomment your -M test line
> and then run smartd (or restart it with "sudo systemctl restart
> smartmontools") and it will send a test email. Once you get that
> working, put the right options into the -M daily line, uncomment that
> and comment the -M test line and restart smartmontools.
>
> If you do install mailutils, you will probably get another daily email
> from the automatic database checking that gets done from
> /etc/cron.daily/optimize_mythdb. Without local email accounts
> working, those emails from anacron never get sent anywhere.
>
> These days, now that I have the Home Assistant app running on my
> phone, I could get Home Assistant to send a notification to my phone.
> And with the Tasker app I can get an audible alarm on any HA
> notification. I have that all set up for my mother's emergency alarm
> button, but have not done it for SMART errors yet.
>
Thank you very much Stephen,
As usual a very thorough reply and much appreciated.
I now have smartd running and am working on getting the remote email part
up.
I also run my own SMTP server but I've only ever connected to it from
Windows boxes and it turns out that on Linux there's a bit more to
The mail program needs to be configured to be able to send emails via your
> normal SMTP server.
...than I was expecting (at least when doing it from the command line).
I'm sure I'll work that out easily enough once I get a bit of time.
Kind Regards,
D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20231120/ac8217d0/attachment.htm>
More information about the mythtv-users
mailing list