r/homelab•
somone77

UPS Shutdown

I'm having some issues finding the right way to script a shutdown event in case of a power outage. I'm sure my situation is not unique but I'm having trouble finding the best way to go about this.

So I have an ESXi host running ~20 virtual machines, some on a local datastore (vital machines such as my NMS and primary DC), however most are on an iSCSI target to a physical FreeNAS server. There is also a secondary samba domain controller which is a physical machine.

Now currently I have the USB interface for my UPS plugged into my ESXi server with the USB passed through to my network monitoring server. This server is set up with NUT and upsmon and is fully configured to shut itself down if the UPS reaches critical charge. Now my issue comes when I want to shut down all the services once the charge goes critical. All of these VMs are Debian based except for two Windows servers (backup server and PDC).

So my question is, what is the best way to execute a shutdown? Obviously to have everything gracefully shut down I need to shut down all VMs that run off of the iSCSI datastore, then shut down the FreeNAS server, then shut down the ESXi host. However I'm not sure how to configure this with upsmon.

Ideally I would love to have these events based upon the percentage of charge left in the UPS (i.e. shut down all VMs that require the FreeNAS server, and the server itself, at around 70% and leave the rest to run the vital services longer).

Currently my servers pull ~1kw of power and the UPS will run under that load for ~20 minutes.

Any help would be greatly appreciated!

Posted Aug 1, 2015, 8:25 AM UTC

810
Loading comments…