[Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
todd at benivegna.com
Sat Aug 15 02:27:52 BST 2020
I did a manual test by physically disconnecting power to the ups and everything worked. I guess the Synology is dumb about doing it via the “upsmon -c fsd” command. All slaves shutdown, the Synology went into safe mode, then the master shut down, then two minutes later the ups powered off. Restored power and all machines powered up on their own and booted up.
Thanks everyone for your help! Much appreciated. Hopefully this happens when the power goes out for real! ;)
Todd Benivegna // todd at benivegna.com
On Aug 14, 2020, 4:52 PM -0400, Roger Price <roger at rogerprice.org>, wrote:
> On Fri, 14 Aug 2020, Todd Benivegna wrote:
> > https://forum.synology.com/enu/viewtopic.php?f=19&t=73960&hilit=ups+slave
> > I have the latest version of the Windows port of NUT (A UPS management package) installed on my Windows 7 machine. The UPS I am using is a
> > very old APC BK650M which is controlled and sends its status via a special serial cable to the Windows machine.
> > I also have my Synology NAS (which uses NUT for its UPS management) connected over the local network as a slave to the Windows NUT master. The
> > Synology slave is configured to immediately go into "safe mode" whenever an FSD (system shutdown message) or OB+LB (On-Battery and Low Battery)
> > indication is received from the Windows NUT master.
> > The Windows master machine responds correctly to OB+LB events, correctly shutting down the master machine. The Synology box also responds to the
> > OB+LB events from the master correctly and goes into "safe mode", the expected behavior.
> > The problem comes when using the command "upsmon -c fsd" on the Windows NUT master to force a UPS system shutdown to test the system. The Windows
> > master shuts down correctly, but the Synology NAS slave does not go into "safe mode" when it receives the FSD notification.
> > I was wondering if there is a bug in the Windows port of NUT such that the FSD notification is not sent to the slaves when "upsmon -c fsd" is
> > executed.
> > I then looked into the Synology NAS NUT configuration more closely.
> > When configured as a NUT slave device, the Synology responds to an FSD notification from the NUT master by calling a script defined in the
> > Synology's /usr/syno/etc/ups/upssched.conf with an "fsd" argument. The script is /usr/syno/bin/synoups.
> > Before causing the NAS to go into "safe mode", the script first retrieves the status of the NUT master with upsc. If the status is "OL" (on-line),
> > the script aborts any action for the received FSD notification. Since the UPS is actually on-line and not in a low battery state when the test FSD
> > is sent from the Windows master, the Synology will not enter "safe mode" - it does nothing.
> Not quite true.
> Script /usr/syno/bin/synoups calls command /usr/sbin/upsmon -c fsd and then
> calls function UPSSafeMode fsd. This function reads the UPS status ups.status
> into variable $St.
> If $St is exactly "OL" the function logs "UPS is On-Line" and exits.
> But if $St = "OL FSD" then the function goes into Safe Mode, stops all services
> and unmounts volumes.
> > If the device was in OB (on battery), LB (low battery), or OB+LB mode, the OL check would fail and the Synology would enter "safe mode", as
> > expected.
> > I tried commenting out the OL status check in the Synology script. The Synology slave then enters "safe mode" when a "upsmon -c fsd" is issued from
> > the Windows master, as expected.
> > Interesting that Synology disables the test functionality on the NAS.
> > Roger, do you know where in /usr/syno/etc/ups/upssched.conf the OL status check is as mentioned above? I'd like to comment that out and see if it works.
> > I'd really like to test everything out without waiting for the battery to run out, but if not then I will do that; will just take about 45 minutes or so.
> > I would never have guessed that it would do a check like that, which basically prevents the "upsmon -c fsd" test!
> In /usr/syno/bin/synoups function UPSSafeMode you need to change
> if [ "$St" = "OL" ]; then
> SYSLOG "WARNING: UPS is On-Line"
> to something like
> if [[ "$St" =~ "OL" ]]; then
> SYSLOG "WARNING: UPS is On-Line"
> This assumes that the NAS supports the =~ operator of Bash 4. To reduce the
> long wait: in the NAS you need to execute
> upsrw -s battery.charge.low=85 -u <upsuser> -p sekret <myups>
> Better is to set this value in the NAS ups.conf.
> Nut-upsuser mailing list
> Nut-upsuser at alioth-lists.debian.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Nut-upsuser