How to setup a server to send emails after starting (i.e. not meaning as an email server)

smtpupswindows-server-2012-r2

Windows Server 2012 R2 w/ GUI, UPS system

I am setting up my first server. It is a Hyper-V host that will host multiple VM servers. The system is on a UPS.

When the UPS detects an AC power failure, the UPS sends an email via an SMTP mail server located elsewhere, and then performs a graceful server shutdown if power is not restored after a certain period of time. When the power is restored, the host machine BIOS is setup to automatically reboot.

I'd like to get emails from the various servers that they have rebooted after power is restored. My UPS doesn't send emails upon AC restore, but even if it did, that wouldn't tell me the servers were back up. I'd like each server to send an email after it is back online.

What steps/methodologies need to be used to accomplish this? By methodologies I mean to ask if I need to write a script, or is there a built-in tool to accomplish this, etc?

I have the SMTP server info, ports, log in credentials, etc. to send an email, I just don't understand how to make a server do that upon power up, or what the standard/best practice is for such notification to normally be handled.

Thanks.

Best Answer

One of the ways you could accomplish this without writing a Powershell script is with a monitoring service. Do you have any type of monitoring currently setup? Most monitoring services will notify that the server is unreachable and then also send a "all clear" email when the server is back up. A few of the free & open source tools I have used are Zabbix and Nagios. They can work with a agent installed or in agentless mode using SNMP. They are also tools ManageEngine that is free for up to 20 servers monitored. https://www.manageengine.com/free-windows-health-monitor/free-windows-health-monitor-index.html

I think this approach is best because it also gives you the ability to monitor other key metrics ( if they are not already monitored).