Correct way to orchestrate shutdown via NUT?

reub

Dabbler
Joined
Sep 22, 2018
Messages
14
I'm trying to configure UPS shutdown so that FreeNAS as MASTER and an ESXi box on my network as SLAVE shutdown in an orderly fashion. Ideally upon a low battery event, I'd like for the ESXi machine to shutdown first, then after a delay sufficient for it to shutdown all guest VMs, the FreeNAS box shuts down. I don't see a clear way to provide values via the UPS service gui to do this or any guidance in the FreeNAS documentation or in my forum searches. There had been a workaround in place that no longer appears available.

My question is (broadly), what's the recommended approach for this? More specifically, is there a persistent way to pass values to upssched.conf or to NUT in general that will accomplish this?

Note: I'm on 11.2U3. I did see a few UPS related bugfixes in today's U4 release but at first glance they don't address this.
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
I'm trying to configure UPS shutdown so that FreeNAS as MASTER and an ESXi box on my network as SLAVE shutdown in an orderly fashion. Ideally upon a low battery event, I'd like for the ESXi machine to shutdown first, then after a delay sufficient for it to shutdown all guest VMs, the FreeNAS box shuts down. I don't see a clear way to provide values via the UPS service gui to do this or any guidance in the FreeNAS documentation or in my forum searches. There had been a workaround in place that no longer appears available.

My question is (broadly), what's the recommended approach for this? More specifically, is there a persistent way to pass values to upssched.conf or to NUT in general that will accomplish this?

Note: I'm on 11.2U3. I did see a few UPS related bugfixes in today's U4 release but at first glance they don't address this.
I've written a couple of resources that may be useful to you:

https://www.ixsystems.com/community...rt-for-single-or-multiple-freenas-servers.30/
https://www.ixsystems.com/community/resources/utility-scripts-for-freenas-and-vmware-esxi.29/
 

reub

Dabbler
Joined
Sep 22, 2018
Messages
14
@Spearfoot thank you. I should note I don't have an AIO setup. FreeNAS is not a guest hosted by ESXi and these are separate physical machines. That said, would I be able to leverage the shutdown command script to (rather than allowing NUT to send the FSD signal to slaves) use a script that shutsdown ESXi via SSH, then waits, then shuts down FreeBSD? I'm assuming this is possible but less preferable to having the ability to leverage the signal sequencing provided by upssched (that seems obscured by the appliance gui).
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
@Spearfoot thank you. I should note I don't have an AIO setup. FreeNAS is not a guest hosted by ESXi and these are separate physical machines. That said, would I be able to leverage the shutdown command script to (rather than allowing NUT to send the FSD signal to slaves) use a script that shutsdown ESXi via SSH, then waits, then shuts down FreeBSD? I'm assuming this is possible but less preferable to having the ability to leverage the signal sequencing provided by upssched (that seems obscured by the appliance gui).
Yes, I understand your circumstances are different. But, as you suggest, you ought to be able to write a script to shut down the ESXi server, wait for an interval, and then shut down FreeNAS itself.
 

reub

Dabbler
Joined
Sep 22, 2018
Messages
14
@Spearfoot I modified your scripts and from command line, I can pretty easily shutdown my machines gracefully but for a reason beyond me, upsmon isn't doing so when I test an ONBATTERY event. It looks (from absence of log activity) that the script never gets called. Is this what you encountered and referred to here? If so, not sure how to proceed with the script method.

My daemon.log shows the following:
Code:
May 13 20:40:51 freenas upsmon[61011]: UPS ups on battery
May 13 20:40:51 freenas upssched[33249]: Executing command: EMAIL
May 13 20:40:51 freenas upssched[33267]: Timer daemon started
May 13 20:40:51 freenas upssched[33267]: New timer: SHUTDOWN (0 seconds)
May 13 20:40:51 freenas upssched[33267]: Event: SHUTDOWN
May 13 20:41:06 freenas upssched[33267]: Timer queue empty, exiting


Note: I also see a bunch of these that I've been trying to eliminate by reducing the poll interval setting (see attached UPS service settings)
Code:
May 13 20:44:20 freenas usbhid-ups[60985]: libusb_get_string: Unknown error



ups-service.png
 
Top