NUT configuration

Jano

Dabbler
Joined
Jan 7, 2014
Messages
31
Hi,

Before I start to "reinvent wheel" I would like to consult with you one issue...

I have few ESXI hosts working on one FREENAS via ISCSI.
I would like to shutdown whole system (ESXIs + FREENAS) when UPS goes on battery.

Theoretically easy,I have NUT as master on FREENAS + slaves of ESXI.

But... FreeNas issues FSD to slaves and starts waiting for them up to HOSTSYNC seconds. ('up to' means --base on my observation-- if all slaves disconect before this time master stops waiting).
It means if all ESXi starts shutdown procedure FREENAS also starts shutdown.

My problem is I wish to keep FREENAS working till all ESXI really turnoff but not when they start shutdown. It is becasue I wish to make suspend of all VMs on ESXI and unfortuantelly FREENAS working during this opertion is very helpful ;)

So, for now I have no better idea than modify script creating upsmon.conf on freenas, change operation executed as SHUDOWDOWN and add there 'sleep' for fixed time.

Any better idea ? Any other solution ?
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
Might this be a rare but valid use for FINALDELAY in upsmon.conf? Although you will obviously have to set an arbitrary time during which you hope the VMs will all complete their suspension. Though you will still have to alter the script creating upsmon.conf, unless you make use of the FreeNAS bug which currently makes FINALDELAY the same time as the shutdown delay when shutting down after a time on battery; I don't recommend this though!
 

Jano

Dabbler
Joined
Jan 7, 2014
Messages
31
There was idea to HOSTSYNC as HOSTSYNC is working for master as well as slaves (at least it is writtien in documentation of NUT).
So it could be great - I can define FINALDELAY on freenas as T and HOSTSYNC on slaves as M where M < T (significantly less).... In result slevaes give up waiting for master and starts shutdown procedure and finaly, after sime time (T) also freenas. But... I did not succeed to have HOSTSYNC working with NUT on ESXi.

Second detailed idea refers to this post was - modify freenas script to create upsmon.conf, define there command SHUTDOWNCMD as calling script and inside this script simple loop making pings on ESXi hosts... freenas should wait up to defined time or when all ESXi "disappear".
I suppose it will work but need to modify freenas scripts which is a little bit odd and as far as it is not necessary I prefer not.

Maybe interesing idea... maybe not only for me would be adding into UI possibility to define custom SHUTDOWNCMD or at least custom settings for UPSMON.conf.
 

rruss

Dabbler
Joined
Sep 14, 2015
Messages
35
I also need this feature.

I have my UPS connected to FreeNAS. All of my linux servers, powered by the same UPS, are slaves to NUT on FreeNAS. FreeNAS will wait until all the other boxes were told to shutdown, but not until they actually shut down. This normally isn't an issue for a cluster of linux machines, but in this case... FreeNAS provides the NFS mounts that the other machines depend on. I want them to cleanly unmount those NFS file systems and then start their shutdown... and that's when I want FreeNAS to begin shutting itself down.

My UPS is very large compared to the load, so I can easily program a fixed delay for FreeNAS to wait before initiating its own shutdown, but I can't figure out a good way to do this with the limited interface to NUT on FreeNAS.
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
As I said above, if you use the 'UPS goes on battery' mode in the FreeNAS GUI, and set a delay time of, say, 300 seconds, then FreeNAS will tell the slaves to shut down after 5 minutes on battery. FreeNAS will then wait a *further* 300 seconds before shutting itself down. This is because as well as setting a 300sec shutdown timer FreeNAS also alters FINALDELAY in upsmon.conf to 300sec. This is a bug, but quite a handy one to do what you want. They appear not to intend to fix it in 9.3.
 

rruss

Dabbler
Joined
Sep 14, 2015
Messages
35
As I said above, if you use the 'UPS goes on battery' mode in the FreeNAS GUI, and set a delay time of, say, 300 seconds, then FreeNAS will tell the slaves to shut down after 5 minutes on battery. FreeNAS will then wait a *further* 300 seconds before shutting itself down. This is because as well as setting a 300sec shutdown timer FreeNAS also alters FINALDELAY in upsmon.conf to 300sec. This is a bug, but quite a handy one to do what you want. They appear not to intend to fix it in 9.3.

This worked for me - thanks rogerh. I'd like to ask that they fix the bug and give us a direct entry on the form to effect FINALDELAY.
 

reub

Dabbler
Joined
Sep 22, 2018
Messages
14
FreeNAS will then wait a *further* 300 seconds before shutting itself down. This is because as well as setting a 300sec shutdown timer FreeNAS also alters FINALDELAY in upsmon.conf to 300sec. This is a bug, but quite a handy one to do what you want. They appear not to intend to fix it in 9.3.

Apologies for resurrecting an old thread but I'm dealing with this issue now on FreeNAS 11.2U3 and it appears the bug has since been fixed.

When the shutdown timer elapses, FreeNAS does not appear to wait for slave(s) to respond before shutting down and I don't see any FINALDELAY value set in upsmon.conf. Is there a way to set this directly either via gui? Is it safe (and persistent) to edit this directly via shell or another way folks have worked around this?
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
Apologies for resurrecting an old thread but I'm dealing with this issue now on FreeNAS 11.2U3 and it appears the bug has since been fixed.

When the shutdown timer elapses, FreeNAS does not appear to wait for slave(s) to respond before shutting down and I don't see any FINALDELAY value set in upsmon.conf. Is there a way to set this directly either via gui? Is it safe (and persistent) to edit this directly via shell or another way folks have worked around this?

It looks as though you are right. I think upsmon.conf is one those files generated on boot by something controlled by the GUI. It seems they have correctly stopped applying the shutdown timer value to FINALDELAY, but have not put a default value in upsmon.conf. I doubt if an edit would be persistent, you would have to do a script to edit upsmon.conf on boot, or at least add a value of FINALDELAY to the end of it.

By the way, HOSTSYNC may be a useful parameter to add to upsmon.conf, as well as a fairly short FINALDELAY, as it waits this many seconds for all the slaves to disconnect, but stops waiting if they all do sooner. A bit academic as we cannot easily add either.
 
Top