davestephens / ansible-nas

Build a full-featured home server or NAS replacement with an Ubuntu box and this playbook.
MIT License
3.22k stars 487 forks source link

SMART Disk Monitoring #2

Open davestephens opened 6 years ago

davestephens commented 6 years ago

Check disks for SMART alert statuses and alert accordingly.

scotws commented 5 years ago

Since I've just had to go through these steps myself with a new main computer (don't ask), I can break this down into multiple steps:

  1. Install a mail agent for notifications, usually postfix, usually so it sends stuff to Gmail
  2. Add the mailutils package because we need mail (the program)
  3. Install smartd through the smartmontools package
  4. Configure smartd, which has a format that is actively hostile to humans

Step 1 and 2 are pretty much required for any serious system anyway (for ZFS, we need mail for notifications of scrubs through the zed anyway). I'm guessing this is going to be a series of documentation texts, because the step with getting a 2FA from Google is probably going to be hard to automate?

allthestairs commented 3 years ago

There exists a nice, seemingly-maintained container for Scrutiny. This handles running smartd, allows for easy configuration, and uses shoutrrr for notifications which allows you to easily set up notifications in addition to having a nice webui.

I've created a prototype integration in a branch https://github.com/allthestairs/ansible-nas/tree/scrutiny

This adds a Scrutiny container to the stats role which is also added in that branch. The container needs the SYS_RAWIO capability and read-only access to /run/udev to run smartd.

There are group_vars set up to allow for:

If anyone has any thoughts on that, let me know. Things to think about: