What's a good way to monitor a self-hosted mail server? I can easily set up uptimerobot.com or similar and get alerted if my website fails, whether it's a DNS, IP, firewall, nginx, TLS^, application, or database issue. Is there a way to check my mail server and get alerted if it is not accepting emails for some reason?
^: uptimerobot.com specifically doesn't warn you if your site works but is using an expired certificate, be careful there
I use and recommend the prometheus blackbox_exporter. You can configure a TCP connectivity check with TLS validation and an SMTP "expect" transcript. If you ran this in the cloud from multiple probing regions/clouds you'd have a monitoring scheme on par with what Google uses to monitor Gmail.
^: uptimerobot.com specifically doesn't warn you if your site works but is using an expired certificate, be careful there