Well, now that I've experienced some sort of disk failure on my NAS, I'm sort of annoyed that I did not set up any sort of notification system.

This is just a standard Ubuntu box sitting in the office. It doesn't have any sort of mail or cloud integration setup.

What would you recommend I use for alerting?

Anyway, I suspect a drive controller failure. It connects but the data is garbage. Can't even get SMART out of it.

@janusfox We have our machines set up so they can send outgoing mail with sendmail, which means stuff like cron email Just Worksβ„’.

We use opensmtpd, and it's pretty simple to set up opensmtpd to relay through your usual mail server _and log in to send stuff_, but you don't really have to do that if you're okay with your mails looking like spam to the mail server.

Anyway, if you've got that working, you could just have a cron job that prints some output and dies if things are horribly wrong, and then you should get mail about it.

@janusfox

so in our /etc/smtpd.conf we've got (among other stuff)

table remotepasswords file:/etc/smtpd/remotepasswords

action "relay" relay
action "relay-proxied" relay host "smtps://[email protected]" auth <remotepasswords>

match for local action "local"
match from any for domain "thunderjaw" action "local"
match from local for domain regex "^[^\.]+$" action "relay"
match from local for any action "relay-proxied"

(the "match from local for domain regex..." bit is probably so we can send mail to other LAN machines without it having to bounce through the mailserver in the sky)

(thunderjaw is this system's hostname)

and then in /etc/smtpd/remotepasswords

thunderjaw thunderjaw:hunter2

(the first "thunderjaw" here is just a local label. the "thunderjaw@" in the relay line looks it up by that. the "thunderjaw:" is the username used to log into the mail server.)

@janusfox this might not be super helpful if you're looking for something more CLOUD CLOUD CLOUDβ„’y though, I dunno

@IceWolf I guess I just need to stop being lazy and install mail :)

Unless there's a USB plug-in klaxon, that'd be fine for me too!

@janusfox hehe failure siren! :3

But yeah, opensmtpd's my rec, it's WAY simpler and less annoying to set up than the likes of exim.

(If you're doing your own full-on mail server somewhere Dovecot is good for the IMAP side, as long as you chuck out all the config Debian ships with. All of it. Toss it in the garbage. You don't need it. They overcomplicated it to hell somehow, hah

but that doesn't matter for this, that's for wherever receives your "shit broke!!" emails. And is not a thing at all if you're sending it to an email account you already have.)

Anyway, if you install the opensmtpd debian package, it'll Provides: mail-transport-agent, automatically remove exim so you only have one, and everything will just use it (your system's mail server will provide a sendmail program that works with it and that's how stuff like cron or your own scripts can send mails)

opensmtpd's debian package USED to have a bug with TLS support which you had to install the one in backports to fix, but I thiiiink that was bookworm and not a concern now that trixie is the new normal.

@janusfox Once you install opensmtpd you'll have fully working local email, like, sending to other users on the same machine type stuff

I'm not sure if it'll attempt sending to other servers, but if it doesn't, the action/match stuff I mentioned in the config post should make it do that.

You can also receive mail from other computers by changing listen on localhost to listen on 0.0.0.0 and/or listen on ::. That match from any for domain "thunderjaw" action "local" bit may be needed as well so you can actually address it from elsewhere (change hostname appropriately of course).

@janusfox But you shouldn't need to receive LAN email, unless you want to get into LAN email as a fun side project. :3
@janusfox @IceWolf I rather like nullmailer as a very lightweight way to connect /usr/sbin/sendmail to an external SMTP server. There are even lighter weight ones (I don't remember the name - it was ages ago I last evaluated these things) but I went with nullmailer as it has a minimal queue so that at least you don't lose outbound mail when the SMTP server is down.

@pippin @janusfox huh! I didn't think about using something that isn't a real mailserver.

What happens to your local email then? As in emailing other local user accounts.

@IceWolf @janusfox I normally use it on servers where it's only going to be sending cron output and the like (with explicit MAILTO= settings in crontab) but I think you can tell it things like what domain to add if you email an unqualified localpart, where to send mail for system users like root, and a few other knobs to twiddle for this stuff. But I believe *all* mail gets shipped to the SMTP gateway - no local delivery at all.