In my home lab, I have 2 ESXi 6.7 hosts (just updated from 5.5) and needed to re-install and re-configure them to shutdown when the power cuts to the UPS connected to my FreeNAS. This is all a lot simpler than it seems at first, and the most important steps are as follows.
1. Enable and Configure NUT on FreeNAS
NUT (Network UPS Tools) comes preinstalled on FreeNAS, so it's as simple as enabling and configuring the service.
Check the box that says "Start on boot", and click the wrench to open the configuration. For explanations of each of the configuration options, there's a great writeup on nixCraft that I'll link to rather than repeating all the details: https://www.cyberciti.biz/faq/how-to-install-apc-ups-on-freenas-server/
A couple important notes:
- Should you choose to use
UPS goes on batteryas your "Shutdown mode" (I did), the "Shutdown timer" value is doubled. Rather: let's say you enter 300 seconds (5 minutes); after 5 minutes of being on battery power, the NAS sends the shutdown command to all connected clients (in this case, the ESXi machine/s) - and then after another 300 seconds, the NAS shuts down.
- As far as I'm aware, the "Monitor Username" and "Monitor Password" are both stored and transmitted in plain text on both the NAS and the ESXi client - so make it a unique combination (something you haven't used for anything else).
2. Install the Client on ESXi
Install René's NUT (Network UPS Tools) client (2.0) for ESXi from here. (Don't speak french? Neither do I, here's a link to the translation). It's as simple as downloading and extracting the archive, uploading the directory to the ESXi box (because installation requires temporarily enabling SSH, I used SFTP) and running the
Once logged into the ESXi web panel, go to Manage > System > "Advanced settings". In the search bar, type in
uservars.nut; this will isolate all the NutClient specific configuration settings. If nothing is showing, you may have to reboot or skip to the next step and start/stop the NutClient service. Enter the [email protected], username/pass. Important note: "NutFinalDelay" is seconds after the shutdown signal was sent by FreeNAS, so you probably want this pretty short.
Then, to make the NutClient software start with ESXi at boot:
- Go to the sidebar "Navigator"
- Under "Host", click "Manage"
- Click the "Services" Tab
- Right-click "NutClient"
- Under "Policy", select
Start and stop with host
And that's all there is to it!