Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-18 Thread Larry Fahnoe
Hi Todd,

On my Synology boxes which are currently running DSM 6.2.3 Update 2,
Control Panel / Hardware & Power / UPS:

Enable UPS support

Network UPS type: Synology UPS server

Time before DiskStation enters Safe mode: 15 min

Network UPS server IP: x.x.x.x


I should probably lower the Safe mode setting as the NUT config is
currently shutting things down after 10 min on battery; I used to let it
run on battery for 20 min, thus the longer Safe mode.

>From upssched.conf on the RPi master:

# Shut down after 10min on battery
AT ONBATT * START-TIMER shutdown-timer 300
AT ONLINE * CANCEL-TIMER shutdown-timer


--Larry


On Fri, Aug 14, 2020 at 11:30 AM Todd Benivegna  wrote:

> Thanks Larry, no problem. I appreciate the input. Whenever you get a
> chance I’d really like to compare notes with someone who has NUT and a
> Synology to see why the heck mine doesn’t work! ;). I’m also using my Pi as
> the master like you. Thanks.
>
> Todd
>
> --
>
> *Todd Benivegna* // t...@benivegna.com
> On Aug 14, 2020, 11:55 AM -0400, Larry Fahnoe ,
> wrote:
>
> On Fri, Aug 14, 2020 at 10:31 AM Todd Benivegna 
> wrote:
>
>> I have not edited a single file, including anything to do with NUT, on
>> the Synology via ssh ever. How is yours configured in the UI? Do you
>> have it set to go into safe mode after a certain number minutes?
>>
>
> Hi Todd,
>
> I misunderstood (have only been casually reading this thread), I thought
> you had been editing files on the Synology, but good to know that it is
> still stock. I do not have access to my Synology appliances (away on
> travel) so I can't give you an accurate answer on how I have it configured.
> I will let you know in a few days (once I have access to them again).
>
> --Larry
>
> --
> Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
>Minneapolis, Minnesota   www.FahnoeTech.com
>
>

-- 
Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
   Minneapolis, Minnesota   www.FahnoeTech.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Todd Benivegna
Hey everyone,

 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! ;)

Regards,

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 14, 2020, 4:52 PM -0400, Roger Price , wrote:
> On Fri, 14 Aug 2020, Todd Benivegna wrote:
>
> > https://forum.synology.com/enu/viewtopic.php?f=19=73960=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"
> return
>
> to something like
>
> if [[ "$St" =~ "OL" ]]; then
> SYSLOG "WARNING: UPS is On-Line"
> return
>
> 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  -p sekret 
>
> Better is to set this value in the NAS ups.conf.
>
> Roger
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Roger Price

On Fri, 14 Aug 2020, Todd Benivegna wrote:


https://forum.synology.com/enu/viewtopic.php?f=19=73960=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"
return

to something like

if [[ "$St" =~ "OL" ]]; then
SYSLOG "WARNING: UPS is On-Line"
return

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  -p sekret 

Better is to set this value in the NAS ups.conf.

Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Todd Benivegna
I found something interesting that I think may apply here.  Check this
out...



https://forum.synology.com/enu/viewtopic.php?f=19=73960=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.*

*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!

On Fri, Aug 14, 2020 at 12:30 PM Todd Benivegna  wrote:

> Thanks Larry, no problem. I appreciate the input. Whenever you get a
> chance I’d really like to compare notes with someone who has NUT and a
> Synology to see why the heck mine doesn’t work! ;). I’m also using my Pi as
> the master like you. Thanks.
>
> Todd
>
> --
>
> *Todd Benivegna* // t...@benivegna.com
> On Aug 14, 2020, 11:55 AM -0400, Larry Fahnoe ,
> wrote:
>
> On Fri, Aug 14, 2020 at 10:31 AM Todd Benivegna 
> wrote:
>
>> I have not edited a single file, including anything to do with NUT, on
>> the Synology via ssh ever. How is yours configured in the UI? Do you
>> have it set to go into safe mode after a certain number minutes?
>>
>
> Hi Todd,
>
> I misunderstood (have only been casually reading this thread), I thought
> you had been editing files on the Synology, but good to know that it is
> still stock. I do not have access to my Synology appliances (away on
> travel) so I can't give you an accurate answer on how I have it configured.
> I will let you know in a few days (once I have access to them again).
>
> --Larry
>
> --
> Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
>Minneapolis, Minnesota   www.FahnoeTech.com
>
>

-- 
*Todd Benivegna* // t...@benivegna.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Todd Benivegna
Sorry, I guess it is  */usr/syno/bin/synoups*

On Fri, Aug 14, 2020 at 2:27 PM Todd Benivegna  wrote:

> I found something interesting that I think may apply here.  Check this
> out...
>
>
>
> https://forum.synology.com/enu/viewtopic.php?f=19=73960=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.*
>
> *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!
>
> On Fri, Aug 14, 2020 at 12:30 PM Todd Benivegna 
> wrote:
>
>> Thanks Larry, no problem. I appreciate the input. Whenever you get a
>> chance I’d really like to compare notes with someone who has NUT and a
>> Synology to see why the heck mine doesn’t work! ;). I’m also using my Pi as
>> the master like you. Thanks.
>>
>> Todd
>>
>> --
>>
>> *Todd Benivegna* // t...@benivegna.com
>> On Aug 14, 2020, 11:55 AM -0400, Larry Fahnoe ,
>> wrote:
>>
>> On Fri, Aug 14, 2020 at 10:31 AM Todd Benivegna 
>> wrote:
>>
>>> I have not edited a single file, including anything to do with NUT, on
>>> the Synology via ssh ever. How is yours configured in the UI? Do you
>>> have it set to go into safe mode after a certain number minutes?
>>>
>>
>> Hi Todd,
>>
>> I misunderstood (have only been casually reading this thread), I thought
>> you had been editing files on the Synology, but good to know that it is
>> still stock. I do not have access to my Synology appliances (away on
>> travel) so I can't give you an accurate answer on how I have it configured.
>> I will let you know in a few days (once I have access to them again).
>>
>> --Larry
>>
>> --
>> Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
>>Minneapolis, Minnesota   www.FahnoeTech.com
>>
>>
>
> --
> *Todd Benivegna* // t...@benivegna.com
>


-- 
*Todd Benivegna* // t...@benivegna.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Todd Benivegna
Thanks Larry, no problem. I appreciate the input. Whenever you get a chance I’d 
really like to compare notes with someone who has NUT and a Synology to see why 
the heck mine doesn’t work! ;). I’m also using my Pi as the master like you. 
Thanks.

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 14, 2020, 11:55 AM -0400, Larry Fahnoe , wrote:
> On Fri, Aug 14, 2020 at 10:31 AM Todd Benivegna  wrote:
> > > I have not edited a single file, including anything to do with NUT, on 
> > > the Synology via ssh ever. How is yours configured in the UI? Do you 
> > > have it set to go into safe mode after a certain number minutes?
>
> Hi Todd,
>
> I misunderstood (have only been casually reading this thread), I thought you 
> had been editing files on the Synology, but good to know that it is still 
> stock. I do not have access to my Synology appliances (away on travel) so I 
> can't give you an accurate answer on how I have it configured. I will let you 
> know in a few days (once I have access to them again).
>
> --Larry
>
> --
> Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
>            Minneapolis, Minnesota       www.FahnoeTech.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Larry Fahnoe
On Fri, Aug 14, 2020 at 10:31 AM Todd Benivegna  wrote:

> I have not edited a single file, including anything to do with NUT, on the
> Synology via ssh ever. How is yours configured in the UI? Do you have
> it set to go into safe mode after a certain number minutes?
>

Hi Todd,

I misunderstood (have only been casually reading this thread), I thought
you had been editing files on the Synology, but good to know that it is
still stock. I do not have access to my Synology appliances (away on
travel) so I can't give you an accurate answer on how I have it configured.
I will let you know in a few days (once I have access to them again).

--Larry

-- 
Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
   Minneapolis, Minnesota   www.FahnoeTech.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Todd Benivegna
Larry,

I have not edited a single file, including anything to do with NUT, on the 
Synology via ssh ever. How is yours configured in the UI? Do you have it 
set to go into safe mode after a certain number minutes?

Earlier, I was just copying and pasting the contents of some files to Roger but 
did not change anything.

--
Todd Benivegna // t...@benivegna.com
On Aug 14, 2020, 8:16 AM -0400, Larry Fahnoe , wrote:
> On Thu, Aug 13, 2020 at 7:46 PM Todd Benivegna  wrote:
> > > So I finally got a test in after I changed my RPi to the master and 
> > > everything else (including my Synology) to slaves.  Before I did that 
> > > though, I timed the shutdown of my Synology since it is the slowest slave 
> > > to shutdown.  It took 40 seconds to shutdown, so I changed HOSTSYNC in 
> > > upsmon.conf on the master (“Proton”) to 60.  I then did a test ("sudo 
> > > upsmon -c fsd”). The slaves shutdown, then eventually the master, but the 
> > > Synology never powered down and the UPS powered off which cut the power 
> > > to it while it was still on.  Anyone know what the heck is going on?  I’m 
> > > feeling a bit cursed, haha.
>
> I wonder if as a result of the tinkering and testing something has gotten 
> mucked up in your Synology's config...perhaps in the config files you were 
> editing? I wonder this because with a stock Synology UPS configuration as a 
> NUT client to my RaspberryPi NUT server, my Synology does power off properly. 
> I do not know if there is a way to restore the Synology's UPS config files to 
> the default configuration, though that might be a worthwhile endeavor for 
> your NAS.
>
> --Larry
>
> --
> Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
>            Minneapolis, Minnesota       www.FahnoeTech.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Larry Fahnoe
On Fri, Aug 14, 2020 at 9:21 AM Aleksandr Karenin 
wrote:

> >I wonder how difficult it would be to rip off their modifications and
> revert to a.standard, functional nut.
>
> I think it should be preatty simple. just rename Synology files and
> replacewith what you think is the best there... it's just a banch of
> scripts nothing more...
>

True for the short term, but what about software updates from Synology?
What about changes via Synology's management interface(s)? I tend to follow
the principle that configuration of appliances should be left to the
vendor's tools and customizations outside of those tools should be avoided.
Custom configuration is best done on the more general purpose platforms
(RPi/Raspbian for example), and then best within the policies and
guidelines of the given distribution.

--Larry

-- 
Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
   Minneapolis, Minnesota   www.FahnoeTech.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Aleksandr Karenin
>I wonder how difficult it would be to rip off their modifications and revert 
>to a.standard, functional nut.

I think it should be preatty simple. just rename Synology files and replacewith 
what you think is the best there... it's just a banch of scripts nothing more...

___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Roger Price

On Fri, 14 Aug 2020, Larry Fahnoe wrote:


I wonder if as a result of the tinkering and testing something has gotten 
mucked up in your Synology's config...perhaps in the config files you were
editing? I wonder this because with a stock Synology UPS configuration as a NUT 
client to my RaspberryPi NUT server, my Synology does power off properly.
I do not know if there is a way to restore the Synology's UPS config files to 
the default configuration, though that might be a worthwhile endeavor for
your NAS.


The Synology config files that I read from Todd's hastebin are at

 http://rogerprice.org/NUT/Synology-config

I assume that these are the originals.

Roger

___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Larry Fahnoe
On Thu, Aug 13, 2020 at 7:46 PM Todd Benivegna  wrote:

> So I finally got a test in after I changed my RPi to the master and
> everything else (including my Synology) to slaves.  Before I did that
> though, I timed the shutdown of my Synology since it is the slowest slave
> to shutdown.  It took 40 seconds to shutdown, so I changed HOSTSYNC in
> upsmon.conf on the master (“Proton”) to 60.  I then did a test ("sudo
> upsmon -c fsd”). The slaves shutdown, then eventually the master, but the
> Synology never powered down and the UPS powered off which cut the power to
> it while it was still on.  Anyone know what the heck is going on?  I’m
> feeling a bit cursed, haha.
>

I wonder if as a result of the tinkering and testing something has gotten
mucked up in your Synology's config...perhaps in the config files you were
editing? I wonder this because with a stock Synology UPS configuration as a
NUT client to my RaspberryPi NUT server, my Synology does power off
properly. I do not know if there is a way to restore the Synology's UPS
config files to the default configuration, though that might be a
worthwhile endeavor for your NAS.

--Larry

-- 
Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
   Minneapolis, Minnesota   www.FahnoeTech.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Aleksandr Karenin
Fortunately, several messages earlier there was an explanation how Synology has 
implemented UPS management.
So SHUTDOWN CMD "" is a normal behaviour. It is managed by scripts outside of 
NUT.

Alex

___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Roger Price

On Thu, 13 Aug 2020, Todd Benivegna wrote:


I’d do that, but I have no idea how to write scripts or setup the trigger….


Aside from the Synology problem, it would help you a lot as a system 
administrator if you learned to write simple Bash scripts.


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-14 Thread Roger Price

On Thu, 13 Aug 2020, Todd Benivegna wrote:

So I finally got a test in after I changed my RPi to the master and everything 
else (including my Synology) to slaves.  Before I did that though, I timed the 
shutdown of my Synology since it is the slowest slave to shutdown.  It took 40 
seconds to shutdown, so I changed HOSTSYNC in upsmon.conf on the master 
(“Proton”) to 60.  I then did a test ("sudo upsmon -c fsd”). The slaves 
shutdown, then eventually the master, but the Synology never powered down and 
the UPS powered off which cut the power to it while it was still on.


In Synology's upsmon.conf, they have SHUTDOWNCMD "".  Perhaps for correct slave 
operation this should be SHUTDOWNCMD "shutdown -h +0" or maybe one of the 
variants which also displays the UPS status and charge such as


 SHUTDOWNCMD "logger -t upsmon.conf \"UPS status at shutdown [$( upsc  ups.status )]:$( 
upsc  battery.charge )\" ; /sbin/shutdown -h +0"

Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-13 Thread Todd Benivegna
Not much in the way of configuration…. I’m pretty sure I’ve got it correct.


--
Todd Benivegna // t...@benivegna.com
On Aug 13, 2020, 8:54 PM -0400, Manuel Wolfshant , 
wrote:
> On August 14, 2020 3:46:05 AM GMT+03:00, Todd Benivegna  
> wrote:
> > So I finally got a test in after I changed my RPi to the master and
> > everything else (including my Synology) to slaves.  Before I did that
> > though, I timed the shutdown of my Synology since it is the slowest
> > slave to shutdown.  It took 40 seconds to shutdown, so I changed
> > HOSTSYNC in upsmon.conf on the master (“Proton”) to 60.  I then did a
> > test ("sudo upsmon -c fsd”). The slaves shutdown, then eventually the
> > master, but the Synology never powered down and the UPS powered off
> > which cut the power to it while it was still on.  Anyone know what the
> > heck is going on?
> Beside the ups mngmnt software ( after Roger's analysis I refuse to call it 
> "nut" any more) on the Synology being a POS ?
> Assuming you did configure correctly the client on the Synology, I guess that 
> probably they reimplemented the slave part just as well as the server..
>
> I wonder how difficult it would be to rip off their modifications and revert 
> to a.standard, functional nut.
>
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-13 Thread Manuel Wolfshant
On August 14, 2020 4:34:17 AM GMT+03:00, Manuel Wolfshant 
 wrote:
>On August 14, 2020 4:01:17 AM GMT+03:00, Todd Benivegna
> wrote:
>>Not much in the way of configuration…. I’m pretty sure I’ve got it
>>correct.
>>
>
>We have a saying here "do not force it, use a bigger hammer".
>Just setup a timer on proton triggered by LB (or whenever you seem fit
>, like  "5 more minutes of power left" ). When activated, have a script
>connect via ssh to the NAS and kindly ask it to shutdown (i.e "ssh
>admin@Synoligy poweroff').
>
>Far from elegant but saves the data.

Actually I thought another ugly hack which replaces the ssh command.
If you have netcat or if bash on the synology knows about /dev/tcp it is easy 
to write a daemon-like script which lustens on a specific port and triggers a 
shutdown when receiving a command from a script launched when needed on proton.

___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-13 Thread Todd Benivegna
> We have a saying here "do not force it, use a bigger hammer".
> Just setup a timer on proton triggered by LB (or whenever you seem fit , like 
> "5 more minutes of power left" ). When activated, have a script connect via 
> ssh to the NAS and kindly ask it to shutdown (i.e "ssh admin@Synoligy 
> poweroff').

I’d do that, but I have no idea how to write scripts or setup the trigger….

--
Todd Benivegna // t...@benivegna.com
On Aug 13, 2020, 9:34 PM -0400, Manuel Wolfshant , 
wrote:
> On August 14, 2020 4:01:17 AM GMT+03:00, Todd Benivegna  
> wrote:
> > Not much in the way of configuration…. I’m pretty sure I’ve got it
> > correct.
> >
>
> We have a saying here "do not force it, use a bigger hammer".
> Just setup a timer on proton triggered by LB (or whenever you seem fit , like 
> "5 more minutes of power left" ). When activated, have a script connect via 
> ssh to the NAS and kindly ask it to shutdown (i.e "ssh admin@Synoligy 
> poweroff').
>
> Far from elegant but saves the data.
>
>
>
>
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-13 Thread Manuel Wolfshant
On August 14, 2020 4:01:17 AM GMT+03:00, Todd Benivegna  
wrote:
>Not much in the way of configuration…. I’m pretty sure I’ve got it
>correct.
>

We have a saying here "do not force it, use a bigger hammer".
Just setup a timer on proton triggered by LB (or whenever you seem fit , like  
"5 more minutes of power left" ). When activated, have a script connect via ssh 
to the NAS and kindly ask it to shutdown (i.e "ssh admin@Synoligy poweroff').

Far from elegant but saves the data.




___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-13 Thread Manuel Wolfshant
On August 14, 2020 3:46:05 AM GMT+03:00, Todd Benivegna  
wrote:
>So I finally got a test in after I changed my RPi to the master and
>everything else (including my Synology) to slaves.  Before I did that
>though, I timed the shutdown of my Synology since it is the slowest
>slave to shutdown.  It took 40 seconds to shutdown, so I changed
>HOSTSYNC in upsmon.conf on the master (“Proton”) to 60.  I then did a
>test ("sudo upsmon -c fsd”). The slaves shutdown, then eventually the
>master, but the Synology never powered down and the UPS powered off
>which cut the power to it while it was still on.  Anyone know what the
>heck is going on?  
Beside the ups mngmnt software ( after Roger's analysis I refuse to call it 
"nut" any more) on the Synology being a POS ? 
Assuming you did configure correctly the client on the Synology, I guess that 
probably they reimplemented the slave part just as well as the server..

I wonder how difficult it would be to rip off their modifications and revert to 
a.standard, functional nut.

___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-13 Thread Todd Benivegna
So I finally got a test in after I changed my RPi to the master and everything 
else (including my Synology) to slaves.  Before I did that though, I timed the 
shutdown of my Synology since it is the slowest slave to shutdown.  It took 40 
seconds to shutdown, so I changed HOSTSYNC in upsmon.conf on the master 
(“Proton”) to 60.  I then did a test ("sudo upsmon -c fsd”). The slaves 
shutdown, then eventually the master, but the Synology never powered down and 
the UPS powered off which cut the power to it while it was still on.  Anyone 
know what the heck is going on?  I’m feeling a bit cursed, haha.

--
Todd Benivegna // t...@benivegna.com
On Aug 12, 2020, 7:07 PM -0400, Todd Benivegna , wrote:
> This fixed everything! Everything appears to be working ok now and all 
> clients are connected. Thank you!
>
> Going to test everything out now.
>
> --
> Todd Benivegna // t...@benivegna.com
> On Aug 12, 2020, 6:16 PM -0400, Charles Lepple , wrote:
> > On Aug 12, 2020, at 5:32 PM, Todd Benivegna  wrote:
> > >
> > > > Those LISTEN lines were appropriate pre-systemd when NUT's startup 
> > > > script was launched after networking was fully enabled. I would 
> > > > recommend "LISTEN 0.0.0.0 3493" instead, and use firewall rules if you 
> > > > are trying to exclude an interface (which is likely not the case on a 
> > > > Pi).
> >
> > > Ok, so replace both with that or just one of the lines? I suspected one 
> > > of the lines may be the problem because when I took out the second line, 
> > > nut-server service wouldn’t fail, but then clients couldn’t connect.
> >
> > Recommend replacing both. Binding to 0.0.0.0 will allow connections to/from 
> > 127.0.0.1. The error handling is not ideal, but upsd logs messages as it 
> > parses. You can stop the service (if systemd is still trying to restart 
> > it), and then try "sudo upsd -D" to see what it is doing. It should respond 
> > to Ctrl-C.
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-12 Thread Todd Benivegna
This fixed everything! Everything appears to be working ok now and all clients 
are connected. Thank you!

Going to test everything out now.

--
Todd Benivegna // t...@benivegna.com
On Aug 12, 2020, 6:16 PM -0400, Charles Lepple , wrote:
> On Aug 12, 2020, at 5:32 PM, Todd Benivegna  wrote:
> >
> > > Those LISTEN lines were appropriate pre-systemd when NUT's startup script 
> > > was launched after networking was fully enabled. I would recommend 
> > > "LISTEN 0.0.0.0 3493" instead, and use firewall rules if you are trying 
> > > to exclude an interface (which is likely not the case on a Pi).
>
> > Ok, so replace both with that or just one of the lines? I suspected one of 
> > the lines may be the problem because when I took out the second line, 
> > nut-server service wouldn’t fail, but then clients couldn’t connect.
>
> Recommend replacing both. Binding to 0.0.0.0 will allow connections to/from 
> 127.0.0.1. The error handling is not ideal, but upsd logs messages as it 
> parses. You can stop the service (if systemd is still trying to restart it), 
> and then try "sudo upsd -D" to see what it is doing. It should respond to 
> Ctrl-C.
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-12 Thread Charles Lepple
On Aug 12, 2020, at 5:32 PM, Todd Benivegna  wrote:
> 
>> Those LISTEN lines were appropriate pre-systemd when NUT's startup script 
>> was launched after networking was fully enabled. I would recommend "LISTEN 
>> 0.0.0.0 3493" instead, and use firewall rules if you are trying to exclude 
>> an interface (which is likely not the case on a Pi).

> Ok, so replace both with that or just one of the lines?  I suspected one of 
> the lines may be the problem because when I took out the second line, 
> nut-server service wouldn’t fail, but then clients couldn’t connect.

Recommend replacing both. Binding to 0.0.0.0 will allow connections to/from 
127.0.0.1. The error handling is not ideal, but upsd logs messages as it 
parses. You can stop the service (if systemd is still trying to restart it), 
and then try "sudo upsd -D" to see what it is doing. It should respond to 
Ctrl-C.
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-12 Thread Todd Benivegna
> If you have problems with having the NAS as master, make it a slave, and run 
> the
> NUT configuration of your choice in your PC/workstation.
I have done just this.  I changed the Synology to a slave and made my Raspberry 
Pi master and the rest of my servers are slaves as well.  Manuel recommnded and 
he is definitely right, I think that is the best way forward, especially with 
your discovery as to what they’re doing to NUT on Synology.  I am having one 
issue getting the nut-server to start up automatically without failing.  You 
have any idea what’s going on there?
> Those LISTEN lines were appropriate pre-systemd when NUT's startup script was 
> launched after networking was fully enabled. I would recommend "LISTEN 
> 0.0.0.0 3493" instead, and use firewall rules if you are trying to exclude an 
> interface (which is likely not the case on a Pi).
Ok, so replace both with that or just one of the lines?  I suspected one of the 
lines may be the problem because when I took out the second line, nut-server 
service wouldn’t fail, but then clients couldn’t connect.
> That is odd, indeed. And yes, it is certainly a permission issue but on
> the journal files which reside below /var/log , not on the config files
>
> Start with journactl -x as it might say more about the error. And maybe
> verify if any log file is defined by the nut-server unit.
I tried journalctl -x and got a huge list, couldn’t even find where nut-service 
was in there.  I tried...

sudo journalctl -x | grep "nut-server"
sudo journalctl -x | grep “error"

And got a few interesting things, but not very descriptive...
https://hastebin.com/ikupojorav.sql

Do you think it may that line upsd.conf like Charles mentioned?

Thanks everyone for all the help!!!

Regards,

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 12, 2020, 12:44 PM -0400, Tim Dawson , wrote:
> 555 gives no write access to the dir, and the files are covered by their
> own perms, so I fail to see any relevance to your comment - sorry . . .
>
> 640 is decent for files, not so much for directories - as noted, the
> fields mean different things on dirs . . .
>
> From the man pages:
>
>    The  letters  rwxXst select file mode bits for the affected
> users: read
>    (r), write (w), execute (or search for directories) (x),
> execute/search
>    only  if  the file is a directory or already has execute
> permission for
>    some user (X), set user or group ID on execution (s),
> restricted  dele-
>
> So while direct access may well still work, there is *ZERO* liability in
> allowing search, and frankly, I don't know what tests NUT may be doing
> to find it's files pre-open, and some may block without that attribute .
> . .
>
> For what it's worth . . .
>
> - Tim
>
>
> On 08/12/2020 03:08 AM, Manuel Wolfshant wrote:
> > On 8/12/20 8:10 AM, Tim Dawson wrote:
> > > For directory permissions, the "x" priv determines if you can access
> > > the directory, so going from 555 (r-x,r-x,r-x) to 640 (rw-,r--,---)
> > > pretty much locks out access to the dir. Myself, I'd go back to 555.
> > > 640 essentially locks the group "nut" out . . .
> > >
> > > - Tim
> >
> > At least if on Todd's system the access rights are identical to mine,
> > no, nut is just fine with 640 because the whole directory is owned by
> > group nut. And nut ( or anyone else but root, actually ) has no
> > business in modifying the config files.  Actually I'd be quite
> > concerned if user "nut" wanted to modify its own config.
> >
> > Logs are written somewhere else.
> >
> >
> >
> > ___
> > Nut-upsuser mailing list
> > Nut-upsuser@alioth-lists.debian.net
> > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
> --
> Tim Dawson
>
> 972-567-9360
>
>
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-12 Thread Tim Dawson
555 gives no write access to the dir, and the files are covered by their 
own perms, so I fail to see any relevance to your comment - sorry . . .


640 is decent for files, not so much for directories - as noted, the 
fields mean different things on dirs . . .


From the man pages:

   The  letters  rwxXst select file mode bits for the affected 
users: read
   (r), write (w), execute (or search for directories) (x), 
execute/search
   only  if  the file is a directory or already has execute 
permission for
   some user (X), set user or group ID on execution (s), 
restricted  dele-


So while direct access may well still work, there is *ZERO* liability in 
allowing search, and frankly, I don't know what tests NUT may be doing 
to find it's files pre-open, and some may block without that attribute . 
. .


For what it's worth . . .

- Tim


On 08/12/2020 03:08 AM, Manuel Wolfshant wrote:

On 8/12/20 8:10 AM, Tim Dawson wrote:
For directory permissions, the "x" priv determines if you can access 
the directory, so going from 555 (r-x,r-x,r-x) to 640 (rw-,r--,---) 
pretty much locks out access to the dir. Myself, I'd go back to 555. 
640 essentially locks the group "nut" out . . .


- Tim


At least if on Todd's system the access rights are identical to mine, 
no, nut is just fine with 640 because the whole directory is owned by 
group nut. And nut ( or anyone else but root, actually ) has no 
business in modifying the config files.  Actually I'd be quite 
concerned if user "nut" wanted to modify its own config.


Logs are written somewhere else.



___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser


--
Tim Dawson

972-567-9360


___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-12 Thread Charles Lepple
On Aug 12, 2020, at 12:11 AM, Todd Benivegna  wrote:
> 
> Here is my upsd.conf:
> 
> LISTEN 127.0.0.1 3493
> LISTEN 192.168.1.31 3493
> 
Those LISTEN lines were appropriate pre-systemd when NUT's startup script was 
launched after networking was fully enabled. I would recommend "LISTEN 0.0.0.0 
3493" instead, and use firewall rules if you are trying to exclude an interface 
(which is likely not the case on a Pi).
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-12 Thread Aleksandr Karenin
The only reason NUT may whant to modify it's config is NUT-CGI and may be 
Synology GUI.
Even then default install on my Synology makes no trubble.

___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-12 Thread Manuel Wolfshant

On 8/12/20 8:10 AM, Tim Dawson wrote:
For directory permissions, the "x" priv determines if you can access 
the directory, so going from 555 (r-x,r-x,r-x) to 640 (rw-,r--,---) 
pretty much locks out access to the dir. Myself, I'd go back to 555. 
640 essentially locks the group "nut" out . . .


- Tim


At least if on Todd's system the access rights are identical to mine, 
no, nut is just fine with 640 because the whole directory is owned by 
group nut. And nut ( or anyone else but root, actually ) has no business 
in modifying the config files.  Actually I'd be quite concerned if user 
"nut" wanted to modify its own config.


Logs are written somewhere else.



___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-12 Thread Manuel Wolfshant

On 8/12/20 7:11 AM, Todd Benivegna wrote:
Ok, so just a follow-up to my last email; still following that guide, 
which is great…. Just stuck on getting the nut-server service starting 
automatically.  Got everything else working.  I’ve been able to get 
the nut-client starting up automatically at boot up (I had a missing 
“1” in upsmon.conf.  Oooops!)  However, I cannot get nut-server 
service to start-up automatically still.


proton@proton:~$ service nut-server status
nut-server.service - Network UPS Tools - power devices information server
     Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; 
vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2020-08-11 23:43:55 
EDT; 2min 0s ago

    Process: 1559 ExecStart=/sbin/upsd (code=exited, status=1/FAILURE)


proton@proton:~$ service nut-client status
nut-monitor.service - Network UPS Tools - power device monitor and 
shutdown controller
     Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled; 
vendor preset: enabled)
     Active: active (running) since Tue 2020-08-11 23:43:55 EDT; 2min 
7s ago

    Process: 1567 ExecStart=/sbin/upsmon (code=exited, status=0/SUCCESS)
   Main PID: 1570 (upsmon)
      Tasks: 2 (limit: 9019)
     CGroup: /system.slice/nut-monitor.service
1569 /lib/nut/upsmon
1570 /lib/nut/upsmon
Warning: some journal files were not opened due to insufficient 
permissions.



I can get it to start manually by doing "sudo service nut-server 
restart".  Then it starts up…. Just starts up and all is good.



proton@proton:~$ sudo service nut-server status
nut-server.service - Network UPS Tools - power devices information server
     Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; 
vendor preset: enabled)

     Active: active (running) since Tue 2020-08-11 23:49:50 EDT; 12s ago
    Process: 2949 ExecStart=/sbin/upsd (code=exited, status=0/SUCCESS)
   Main PID: 2950 (upsd)
      Tasks: 1 (limit: 9019)
     CGroup: /system.slice/nut-server.service
2950 /lib/nut/upsd
Aug 11 23:49:50 proton upsd[2949]: listening on 127.0.0.1 port 3493
Aug 11 23:49:50 proton upsd[2949]: listening on 127.0.0.1 port 3493
Aug 11 23:49:50 proton upsd[2949]: Connected to UPS [ups]: usbhid-ups-ups
Aug 11 23:49:50 proton upsd[2949]: Connected to UPS [ups]: usbhid-ups-ups
Aug 11 23:49:50 proton upsd[2950]: Startup successful
Aug 11 23:49:50 proton systemd[1]: Started Network UPS Tools - power 
devices information server.
Aug 11 23:49:50 proton upsd[2950]: User upsmon_local@127.0.0.1 logged 
into UPS [ups]
Aug 11 23:49:51 proton upsd[2950]: User monuser@192.168.1.70 logged 
into UPS [ups]
Aug 11 23:49:53 proton upsd[2950]: User upsmon_remote@192.168.1.30 
logged into UPS [ups]
Aug 11 23:49:53 proton upsd[2950]: User upsmon_remote@192.168.1.20 
logged into UPS [ups]




Here is my upsd.conf:

LISTEN 127.0.0.1 3493
LISTEN 192.168.1.31 3493



Could it be a permissions issue?  Weird that all it takes is me 
manually doing "sudo service nut-server restart” is all it 
takes.  Clients connect and everything.



That is odd, indeed. And yes, it is certainly a permission issue but on 
the journal files which reside below /var/log , not on the config files


Start with journactl -x as it might say more about the error. And maybe 
verify if any log file is defined by the nut-server unit.


M.




___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-12 Thread Roger Price

On Wed, 12 Aug 2020, Manuel Wolfshant wrote:

So nut on Synology believes that it is a good idea to trigger a FSD 30 secs 
AFTER switching back to line power when in fact it should CANCEL any shutdown 
in progress. Unless you have the willingness to search & fix whatever 
stupidities they do in their unorthodox use of nut... just use a sane version


Agreed. Could this be the cause of the unexpected shutdowns? In Synology's 
function UPSShutdown :


OL=0
LB=0
while [ $OL -ne 2 -a $LB -ne 2 ]; do
sleep 10
St=`UPSStatusGet`

Function UPSStatusGet returns the current value of ups.status. Consider the case 
where upsc returns [OL CHRG], the following code will set LB to 2 after 20 sec 
even though the UPS is online.


if [ "$St" = "OL" ]; then
OL=`expr $OL + 1`
LB=0
else
LB=`expr $LB + 1`
OL=0
fi
echo "OL=$OL LB=$LB" >> $SZF_SAFEMODE
done
if [ $OL -eq 2 ]; then
synologset1 sys warn 0x11300012
echo "UPS back to On-Line and reboot." >> $SZF_SAFEMODE
$SYNOBOOTBIN --unset-safe-shutdown
telinit 6

The following code is executed leading to a shutdown via the flag SZF_SAFEMODE:

elif [ $LB -eq 2 ]; then
touch /var/.NormalShutdown
if [ $UPSSafeShutdown -eq 0 ]; then
echo "Waiting UPS exhausted." >> $SZF_SAFEMODE
SYSLOG "Waiting UPS exhausted."
else
echo "UPS safe shutdown." >> $SZF_SAFEMODE
SYSLOG "UPS safe shutdown."

I will write a more complete report on Synology's Safe Mode, but I would 
recommend treating the NAS as a slave and running a correctly configured NUT in 
one of the Ubuntu machines.  Todd, if you need more detailed examples of NUT 
configurations, see http://rogerprice.org/NUT/ConfigExamples.A5.pdf


Roger

___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-11 Thread Todd Benivegna
Ok, so just a follow-up to my last email; still following that guide, which is 
great…. Just stuck on getting the nut-server service starting automatically.  
Got everything else working.  I’ve been able to get the nut-client starting up 
automatically at boot up (I had a missing “1” in upsmon.conf.  Oooops!)  
However, I cannot get nut-server service to start-up automatically still.

proton@proton:~$ service nut-server status
nut-server.service - Network UPS Tools - power devices information server
     Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; vendor 
preset: enabled)
     Active: failed (Result: exit-code) since Tue 2020-08-11 23:43:55 EDT; 2min 
0s ago
    Process: 1559 ExecStart=/sbin/upsd (code=exited, status=1/FAILURE)


proton@proton:~$ service nut-client status
nut-monitor.service - Network UPS Tools - power device monitor and shutdown 
controller
     Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled; vendor 
preset: enabled)
     Active: active (running) since Tue 2020-08-11 23:43:55 EDT; 2min 7s ago
    Process: 1567 ExecStart=/sbin/upsmon (code=exited, status=0/SUCCESS)
   Main PID: 1570 (upsmon)
      Tasks: 2 (limit: 9019)
     CGroup: /system.slice/nut-monitor.service
1569 /lib/nut/upsmon
1570 /lib/nut/upsmon
Warning: some journal files were not opened due to insufficient permissions.


I can get it to start manually by doing "sudo service nut-server restart".  
Then it starts up…. Just starts up and all is good.


proton@proton:~$ sudo service nut-server status
nut-server.service - Network UPS Tools - power devices information server
     Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; vendor 
preset: enabled)
     Active: active (running) since Tue 2020-08-11 23:49:50 EDT; 12s ago
    Process: 2949 ExecStart=/sbin/upsd (code=exited, status=0/SUCCESS)
   Main PID: 2950 (upsd)
      Tasks: 1 (limit: 9019)
     CGroup: /system.slice/nut-server.service
2950 /lib/nut/upsd
Aug 11 23:49:50 proton upsd[2949]: listening on 127.0.0.1 port 3493
Aug 11 23:49:50 proton upsd[2949]: listening on 127.0.0.1 port 3493
Aug 11 23:49:50 proton upsd[2949]: Connected to UPS [ups]: usbhid-ups-ups
Aug 11 23:49:50 proton upsd[2949]: Connected to UPS [ups]: usbhid-ups-ups
Aug 11 23:49:50 proton upsd[2950]: Startup successful
Aug 11 23:49:50 proton systemd[1]: Started Network UPS Tools - power devices 
information server.
Aug 11 23:49:50 proton upsd[2950]: User upsmon_local@127.0.0.1 logged into UPS 
[ups]
Aug 11 23:49:51 proton upsd[2950]: User monuser@192.168.1.70 logged into UPS 
[ups]
Aug 11 23:49:53 proton upsd[2950]: User upsmon_remote@192.168.1.30 logged into 
UPS [ups]
Aug 11 23:49:53 proton upsd[2950]: User upsmon_remote@192.168.1.20 logged into 
UPS [ups]



Here is my upsd.conf:

LISTEN 127.0.0.1 3493
LISTEN 192.168.1.31 3493



Could it be a permissions issue?  Weird that all it takes is me manually doing 
"sudo service nut-server restart” is all it takes.  Clients connect and 
everything.

Thanks,

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 11, 2020, 10:29 PM -0400, Todd Benivegna , wrote:
> Thanks Manuel.  I’m following that guide but am now stuck when checking to 
> make sure the nut-sever and nut-client are up and working.  I got this:
>
> proton@proton:~$ service nut-server status
> nut-server.service - Network UPS Tools - power devices information server
>      Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; vendor 
> preset: enabled)
>      Active: failed (Result: exit-code) since Tue 2020-08-11 22:13:42 EDT; 
> 1min 18s ago
>     Process: 1537 ExecStart=/sbin/upsd (code=exited, status=1/FAILURE)
>
> Warning: some journal files were not opened due to insufficient permissions.
>
>
>
> proton@proton:~$ service nut-client status
> nut-monitor.service - Network UPS Tools - power device monitor and shutdown 
> controller
>      Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled; vendor 
> preset: enabled)
>      Active: failed (Result: exit-code) since Tue 2020-08-11 22:13:42 EDT; 
> 1min 50s ago
>     Process: 1543 ExecStart=/sbin/upsmon (code=exited, status=1/FAILURE)
>
> Warning: some journal files were not opened due to insufficient permissions.
>
>
>
> Do I have incorrect permission on the conf files?  I did change this a while 
> back.  Why should the default permissions be on the nut folder and the files 
> in the nut folder?  I changed from 555 to 640 I believe.
>
> proton@proton:~$ sudo ls -la /etc/nut
> total 60
> drw-r-   2 root nut   4096 Aug 11 22:13 .
> drwxr-xr-x 147 root root 12288 Aug 11 22:02 ..
> -rw-r-   1 root nut   1543 Aug 11 22:13 nut.conf
> -rw-r-   1 root nut   5615 Aug 11 21:59 ups.conf
> -rw-r-   1 root nut   4601 Aug 11 22:04 upsd.conf
> -rw-r-   1 root nut   2466 Aug 11 22:09 upsd.users
> -rw-r-   1 root nut  15479 Aug 11 22:12 upsmon.conf
> -rw-r-   1 root nut   3879 Feb  8  2020 upssched.conf
>
> --
> Todd Benivegna // t...@benivegna.com
> On Aug 

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-11 Thread Todd Benivegna
Thanks Manuel.  I’m following that guide but am now stuck when checking to make 
sure the nut-sever and nut-client are up and working.  I got this:

proton@proton:~$ service nut-server status
nut-server.service - Network UPS Tools - power devices information server
     Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; vendor 
preset: enabled)
     Active: failed (Result: exit-code) since Tue 2020-08-11 22:13:42 EDT; 1min 
18s ago
    Process: 1537 ExecStart=/sbin/upsd (code=exited, status=1/FAILURE)

Warning: some journal files were not opened due to insufficient permissions.



proton@proton:~$ service nut-client status
nut-monitor.service - Network UPS Tools - power device monitor and shutdown 
controller
     Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled; vendor 
preset: enabled)
     Active: failed (Result: exit-code) since Tue 2020-08-11 22:13:42 EDT; 1min 
50s ago
    Process: 1543 ExecStart=/sbin/upsmon (code=exited, status=1/FAILURE)

Warning: some journal files were not opened due to insufficient permissions.



Do I have incorrect permission on the conf files?  I did change this a while 
back.  Why should the default permissions be on the nut folder and the files in 
the nut folder?  I changed from 555 to 640 I believe.

proton@proton:~$ sudo ls -la /etc/nut
total 60
drw-r-   2 root nut   4096 Aug 11 22:13 .
drwxr-xr-x 147 root root 12288 Aug 11 22:02 ..
-rw-r-   1 root nut   1543 Aug 11 22:13 nut.conf
-rw-r-   1 root nut   5615 Aug 11 21:59 ups.conf
-rw-r-   1 root nut   4601 Aug 11 22:04 upsd.conf
-rw-r-   1 root nut   2466 Aug 11 22:09 upsd.users
-rw-r-   1 root nut  15479 Aug 11 22:12 upsmon.conf
-rw-r-   1 root nut   3879 Feb  8  2020 upssched.conf

--
Todd Benivegna // t...@benivegna.com
On Aug 11, 2020, 9:09 PM -0400, Manuel Wolfshant , 
wrote:
> On 8/12/20 3:55 AM, Todd Benivegna wrote:
> > Manuel,
> >
> > You are absolutely right.  I think this is all the Synology just being
> > very dumb.  I guess those are my only two options at this point.
> >
> > I have no idea on how to set up the NUT server though on one of my
> > NUCs or my Pi.  Do you know any good guides out there?
>
> there are literally tons of guides. for instance:
>
> https://www.reddit.com/r/homelab/comments/5ssb5h/ups_server_on_raspberry_pi/
> and scroll down to configuring, past the apt install step (which you
> already did )
>
> basically all you need is to edit a few files below /etc/nut/ . takes 5
> min top
>
>
> >   I’m guessing it’s easy enough to edit upsmon.conf on the Synology in
> > order to get that to become a slave; I think would be all that’s
> > required for the Synology NAS.
>
>
> > Yeah I saw that.  Makes no sense.  I can Wireshark it, however even if
> > I find the cause, I’d still have to go to Synology for resolution,
> > which I doubt will ever get fixed.  Even if they do, I doubt it’d be
> > any time soon.  Maybe that’s me being pessimistic, I don’t know, but I
> > just don’t if I have the time or energy for all that!
> >
> no need to wireshark any more, we already know that it sends bogus FSD
>
>
>
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-11 Thread Manuel Wolfshant

On 8/12/20 3:55 AM, Todd Benivegna wrote:

Manuel,

You are absolutely right.  I think this is all the Synology just being 
very dumb.  I guess those are my only two options at this point.


I have no idea on how to set up the NUT server though on one of my 
NUCs or my Pi.  Do you know any good guides out there?


there are literally tons of guides. for instance:

https://www.reddit.com/r/homelab/comments/5ssb5h/ups_server_on_raspberry_pi/ 
and scroll down to configuring, past the apt install step (which you 
already did )


basically all you need is to edit a few files below /etc/nut/ . takes 5 
min top



  I’m guessing it’s easy enough to edit upsmon.conf on the Synology in 
order to get that to become a slave; I think would be all that’s 
required for the Synology NAS.



Yeah I saw that.  Makes no sense.  I can Wireshark it, however even if 
I find the cause, I’d still have to go to Synology for resolution, 
which I doubt will ever get fixed.  Even if they do, I doubt it’d be 
any time soon.  Maybe that’s me being pessimistic, I don’t know, but I 
just don’t if I have the time or energy for all that!



no need to wireshark any more, we already know that it sends bogus FSD



___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-11 Thread Todd Benivegna
Yeah I saw that.  Makes no sense.  I can Wireshark it, however even if I find 
the cause, I’d still have to go to Synology for resolution, which I doubt will 
ever get fixed.  Even if they do, I doubt it’d be any time soon.  Maybe that’s 
me being pessimistic, I don’t know, but I just don’t if I have the time or 
energy for all that!

--
Todd Benivegna // t...@benivegna.com
On Aug 11, 2020, 8:57 PM -0400, Manuel Wolfshant , 
wrote:
> On 8/12/20 3:42 AM, Manuel Wolfshant wrote:
> > On 8/12/20 3:20 AM, Todd Benivegna wrote:
> > > Hi everyone,
> > >
> > > Well, we lost power here again.  I was not at home, but I guess a dump 
> > > truck smashed into some power poles and took out half the city; actually 
> > > tripped most of the breakers in the panel.  Anyways, the power was out 
> > > for just a few seconds and of course my servers shutdown on me after 
> > > power being out for just a second or two.  Here is my syslog from two 
> > > different machines.  I included everything just in case.
> > >
> > > “Proton": https://hastebin.com/uluqaqetuc.bash
> > > "Plex”: https://hastebin.com/apudatonun.sql
> > >
> > > Let me know what you think.  I just tested everything over the weekend 
> > > and it all worked perfectly; cut power and machines stayed up until it 
> > > was time to shut them down (I temporarily configured them to shut down 
> > > after 5 minutes so I didn’t have to wait for the entire battery to 
> > > drain).  I seriously at am a total loss.  I guess HDD Hibernation was not 
> > > the culprit either since I’m still getting the same results.   Ugh.  
> > > Thanks everyone for all your help so far!
> > >
> > > Regards,
> > >
> > > Todd
> >
> > Todd, you fight against some stupid stuff happening in the Synology NAS.
> I forgot to mention the reasoning. From your proton and plex logs:
> Aug 11 16:37:40 proton upsmon[1554]: UPS ups@192.168.1.70 on battery
> Aug 11 16:37:45 proton upsmon[1554]: UPS ups@192.168.1.70 on line power
> Aug 11 16:38:10 proton upsmon[1554]: UPS ups@192.168.1.70: forced shutdown in 
> progress
>
> Aug 11 16:37:43 plex upsmon[974]: UPS ups@192.168.1.70 on battery
> Aug 11 16:37:48 plex upsmon[974]: UPS ups@192.168.1.70 on line power
> Aug 11 16:38:13 plex upsmon[974]: UPS ups@192.168.1.70: forced shutdown in 
> progress
>
> So nut on Synology believes that it is a good idea to trigger a FSD 30 secs 
> AFTER switching back to line power when in fact it should CANCEL any shutdown 
> in progress. Unless you have the willingness to search & fix whatever 
> stupidities they do in their unorthodox use of nut... just use a sane version
>
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-11 Thread Manuel Wolfshant

On 8/12/20 3:42 AM, Manuel Wolfshant wrote:

On 8/12/20 3:20 AM, Todd Benivegna wrote:

Hi everyone,

Well, we lost power here again.  I was not at home, but I guess a 
dump truck smashed into some power poles and took out half the city; 
actually tripped most of the breakers in the panel.  Anyways, the 
power was out for just a few seconds and of course my servers 
shutdown on me after power being out for just a second or two.  Here 
is my syslog from two different machines.  I included everything just 
in case.


“Proton": https://hastebin.com/uluqaqetuc.bash
"Plex”: https://hastebin.com/apudatonun.sql

Let me know what you think.  I just tested everything over the 
weekend and it all worked perfectly; cut power and machines stayed up 
until it was time to shut them down (I temporarily configured them to 
shut down after 5 minutes so I didn’t have to wait for the entire 
battery to drain).  I seriously at am a total loss.  I guess HDD 
Hibernation was not the culprit either since I’m still getting the 
same results.   Ugh.  Thanks everyone for all your help so far!


Regards,

Todd


Todd, you fight against some stupid stuff happening in the Synology NAS. 

I forgot to mention the reasoning. From your proton and plex logs:

|Aug 11 16:37:40 proton upsmon[1554]: UPS ups@192.168.1.70 on battery 
Aug 11 16:37:45 proton upsmon[1554]: UPS ups@192.168.1.70 on line power|
|Aug 11 16:38:10 proton upsmon[1554]: UPS ups@192.168.1.70: forced 
shutdown in progress|

||
||Aug 11 16:37:43 plex upsmon[974]: UPS ups@192.168.1.70 on battery Aug 
11 16:37:48 plex upsmon[974]: UPS ups@192.168.1.70 on line power Aug 11 
16:38:13 plex upsmon[974]: UPS ups@192.168.1.70: forced shutdown in 
progress||

||
|So nut on Synology believes that it is a good idea to trigger a FSD 30 
secs AFTER switching back to line power when in fact it should CANCEL 
any shutdown in progress. Unless you have the willingness to search & 
fix whatever stupidities they do in their unorthodox use of nut... just 
use a sane version |

||

|
|
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-11 Thread Todd Benivegna
Manuel,

You are absolutely right.  I think this is all the Synology just being very 
dumb.  I guess those are my only two options at this point.

I have no idea on how to set up the NUT server though on one of my NUCs or my 
Pi.  Do you know any good guides out there?  I’m guessing it’s easy enough to 
edit upsmon.conf on the Synology in order to get that to become a slave; I 
think would be all that’s required for the Synology NAS.

Thanks,

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 11, 2020, 8:43 PM -0400, Manuel Wolfshant , 
wrote:
> On 8/12/20 3:20 AM, Todd Benivegna wrote:
> > Hi everyone,
> >
> > Well, we lost power here again.  I was not at home, but I guess a dump
> > truck smashed into some power poles and took out half the city;
> > actually tripped most of the breakers in the panel.  Anyways, the
> > power was out for just a few seconds and of course my servers shutdown
> > on me after power being out for just a second or two.  Here is my
> > syslog from two different machines.  I included everything just in case.
> >
> > “Proton": https://hastebin.com/uluqaqetuc.bash
> > "Plex”: https://hastebin.com/apudatonun.sql
> >
> > Let me know what you think.  I just tested everything over the weekend
> > and it all worked perfectly; cut power and machines stayed up until it
> > was time to shut them down (I temporarily configured them to shut down
> > after 5 minutes so I didn’t have to wait for the entire battery to
> > drain).  I seriously at am a total loss.  I guess HDD Hibernation was
> > not the culprit either since I’m still getting the same results.
> >  Ugh.  Thanks everyone for all your help so far!
> >
> > Regards,
> >
> > Todd
>
> Todd, you fight against some stupid stuff happening in the Synology NAS.
> You will get your life back just setting one of the PIs as server and
> letting the NAS (and the other 2 computers ) be its slave(s). nut works
> perfectly fine on PIs for ages.
>
> As a side note, I still believe that the NAS sends some stupid command
> and that you will not see it unless you sniff the conversation.
>
>
>
>
>
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-11 Thread Manuel Wolfshant

On 8/12/20 3:20 AM, Todd Benivegna wrote:

Hi everyone,

Well, we lost power here again.  I was not at home, but I guess a dump 
truck smashed into some power poles and took out half the city; 
actually tripped most of the breakers in the panel.  Anyways, the 
power was out for just a few seconds and of course my servers shutdown 
on me after power being out for just a second or two.  Here is my 
syslog from two different machines.  I included everything just in case.


“Proton": https://hastebin.com/uluqaqetuc.bash
"Plex”: https://hastebin.com/apudatonun.sql

Let me know what you think.  I just tested everything over the weekend 
and it all worked perfectly; cut power and machines stayed up until it 
was time to shut them down (I temporarily configured them to shut down 
after 5 minutes so I didn’t have to wait for the entire battery to 
drain).  I seriously at am a total loss.  I guess HDD Hibernation was 
not the culprit either since I’m still getting the same results.  
 Ugh.  Thanks everyone for all your help so far!


Regards,

Todd


Todd, you fight against some stupid stuff happening in the Synology NAS. 
You will get your life back just setting one of the PIs as server and 
letting the NAS (and the other 2 computers ) be its slave(s). nut works 
perfectly fine on PIs for ages.


As a side note, I still believe that the NAS sends some stupid command 
and that you will not see it unless you sniff the conversation.






___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-11 Thread Todd Benivegna
Hi everyone,

Well, we lost power here again.  I was not at home, but I guess a dump truck 
smashed into some power poles and took out half the city; actually tripped most 
of the breakers in the panel.  Anyways, the power was out for just a few 
seconds and of course my servers shutdown on me after power being out for just 
a second or two.  Here is my syslog from two different machines.  I included 
everything just in case.

“Proton":  https://hastebin.com/uluqaqetuc.bash
"Plex”:  https://hastebin.com/apudatonun.sql

Let me know what you think.  I just tested everything over the weekend and it 
all worked perfectly; cut power and machines stayed up until it was time to 
shut them down (I temporarily configured them to shut down after 5 minutes so I 
didn’t have to wait for the entire battery to drain).  I seriously at am a 
total loss.  I guess HDD Hibernation was not the culprit either since I’m still 
getting the same results.   Ugh.  Thanks everyone for all your help so far!

Regards,

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 11, 2020, 7:32 AM -0400, Larry Fahnoe , wrote:
> On Tue, Aug 11, 2020 at 12:46 AM Roger Price  wrote:
> > > On Mon, 10 Aug 2020, Todd Benivegna wrote:
> > >
> > > > synoups: https://hastebin.com/xexafofiha.bash
> > >
> > > Wow! What a mess.  It looks as if Synology wanted to write their own 
> > > "NUT", but
> > > decided it would be easier to put their ideas in a script when they saw 
> > > they
> > > could use upssched.conf to call it.  NUT intends such a script for timer
> > > management.  Synology use it for general system management.
>
> Roger's comment confirms my suspicion of NUT as provided by Synology. They 
> make a great NAS product, but then they bolt on all manner of other things. 
> In my opinion, best to leave the NAS as an appliance configured and managed 
> by their GUI tools, and let it just be a NUT client rather than trying to 
> configure it to be the NUT server. I use and find the RaspberryPi's to be 
> very capable NUT servers with the rest of my systems (including my Synology 
> NAS) as NUT clients. Much simpler to manage that way as you have complete 
> control over a fairly current NUT as provided by Raspbian (a Debian 
> derivative). The only kink I've run into is that the Synology NAS as a NUT 
> client provides no means of changing the NUT credentials, so you have to use 
> default credentials for NUT (another reason to make sure NUT is on a 
> protected network).
>
> --Larry
>
> --
> Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
>            Minneapolis, Minnesota       www.FahnoeTech.com
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-11 Thread Larry Fahnoe
On Tue, Aug 11, 2020 at 12:46 AM Roger Price  wrote:

> On Mon, 10 Aug 2020, Todd Benivegna wrote:
>
> > synoups: https://hastebin.com/xexafofiha.bash
>
> Wow! What a mess.  It looks as if Synology wanted to write their own
> "NUT", but
> decided it would be easier to put their ideas in a script when they saw
> they
> could use upssched.conf to call it.  NUT intends such a script for timer
> management.  Synology use it for general system management.
>

Roger's comment confirms my suspicion of NUT as provided by Synology. They
make a great NAS product, but then they bolt on all manner of other things.
In my opinion, best to leave the NAS as an appliance configured and managed
by their GUI tools, and let it just be a NUT client rather than trying to
configure it to be the NUT server. I use and find the RaspberryPi's to be
very capable NUT servers with the rest of my systems (including my Synology
NAS) as NUT clients. Much simpler to manage that way as you have complete
control over a fairly current NUT as provided by Raspbian (a Debian
derivative). The only kink I've run into is that the Synology NAS as a NUT
client provides no means of changing the NUT credentials, so you have to
use default credentials for NUT (another reason to make sure NUT is on a
protected network).

--Larry

-- 
Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
   Minneapolis, Minnesota   www.FahnoeTech.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-10 Thread Roger Price

On Mon, 10 Aug 2020, Todd Benivegna wrote:


synoups: https://hastebin.com/xexafofiha.bash


Wow! What a mess.  It looks as if Synology wanted to write their own "NUT", but 
decided it would be easier to put their ideas in a script when they saw they 
could use upssched.conf to call it.  NUT intends such a script for timer 
management.  Synology use it for general system management.


 1. Could you show us the file /usr/syno/bin/synoupscommon ?

 2. Could you log into the NAS and execute ls -alF /bin/sh ?

Roger

___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-10 Thread Todd Benivegna
Here ya go, this should work.

synoups:
https://hastebin.com/xexafofiha.bash

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 10, 2020, 9:04 AM -0400, Todd Benivegna , wrote:
> Wow. That’s weird. Blank for me too! I will send again when I get home. Sorry 
> about that!
>
> --
> Todd Benivegna // t...@benivegna.com
> On Aug 10, 2020, 9:01 AM -0400, Roger Price , wrote:
> > On Mon, 10 Aug 2020, Todd Benivegna wrote:
> >
> > > Here is the /usr/syno/bin/synoups file
> > > https://hastebin.com/sibopejuyu.bash
> >
> > Firefox, Opera, w3m, lynx, and wget all report that this link is empty. Do 
> > you
> > see anything?
> >
> > Roger
> >
> > ___
> > Nut-upsuser mailing list
> > Nut-upsuser@alioth-lists.debian.net
> > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-10 Thread Todd Benivegna
Wow. That’s weird. Blank for me too! I will send again when I get home. Sorry 
about that!

--
Todd Benivegna // t...@benivegna.com
On Aug 10, 2020, 9:01 AM -0400, Roger Price , wrote:
> On Mon, 10 Aug 2020, Todd Benivegna wrote:
>
> > Here is the /usr/syno/bin/synoups file
> > https://hastebin.com/sibopejuyu.bash
>
> Firefox, Opera, w3m, lynx, and wget all report that this link is empty. Do you
> see anything?
>
> Roger
>
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-10 Thread Todd Benivegna
Hi Roger,

Here is the /usr/syno/bin/synoups file

https://hastebin.com/sibopejuyu.bash

Thanks,

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 9, 2020, 4:49 PM -0400, Roger Price , wrote:
> On Sun, 9 Aug 2020, Todd Benivegna wrote:
>
> > upssched.conf (on Synology):
> > CMDSCRIPT /usr/syno/bin/synoups
> >
> > upssched-cmd (on Synology):
> > I don’t see this file.
>
> The CMDSCRIPT declaration says that in a Synology box the file that NUT calls
> upssched-cmd is called /usr/syno/bin/synoups. Could we see this file? Thanks.
>
> > What is "Safe mode"?  Is it complete power down?, or some sort of 
> > hibernation?
> > If it's not a complete power down, how is the hibernation powered?
> >
> > "When the Synology NAS enters Safe Mode, it stops all services and unmounts 
> > volumes in order to prevent data loss and shut down (halt for
> > EDS14) safely when the UPS device runs out of power. By default, the system 
> > enters Safe Mode when the UPS device starts running low on power.
> > You can also specify the amount of time before the Synology NAS enters Safe 
> > Mode when power failure occurs. However, if the UPS device reaches
> > low battery before the specified time, the system enters Safe Mode 
> > immediately.
> >
> > In situations where the Synology NAS shuts down during Safe Mode, it will 
> > automatically turn on when power is restored if you have enabled the
> > Restart automatically after a power failure option (located at Control 
> > Panel > Hardware & Power > General)."
>
> This reads like typical sales literature. I admit to being none the wiser even
> after reading it several times.
>
> > I gather this puts it in a state where it is ready for imminent power loss 
> > and
> > won’t damage or lose any data.
>
> How long can this last? Who supplies the power to the NAS during "Safe mode"?
>
> > Ok, I will comment that back out.  That won’t interfere with anything?  What
> > user would it run as?  Will it have access to upsmon.conf?
>
> Ubuntu very probably has user nut set up to run NUT and has the permissions 
> set
> accordingly. If it's possible to execute "command ps -elf | grep nut" in a
> running NAS you will see user nut in action.
>
> Roger
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Roger Price

On Sun, 9 Aug 2020, Todd Benivegna wrote:


upssched.conf (on Synology):
CMDSCRIPT /usr/syno/bin/synoups

upssched-cmd (on Synology):
I don’t see this file.  


The CMDSCRIPT declaration says that in a Synology box the file that NUT calls 
upssched-cmd is called /usr/syno/bin/synoups.  Could we see this file?  Thanks.



  What is "Safe mode"?  Is it complete power down?, or some sort of 
hibernation? 
  If it's not a complete power down, how is the hibernation powered?

  "When the Synology NAS enters Safe Mode, it stops all services and 
unmounts volumes in order to prevent data loss and shut down (halt for
  EDS14) safely when the UPS device runs out of power. By default, the 
system enters Safe Mode when the UPS device starts running low on power.
  You can also specify the amount of time before the Synology NAS enters 
Safe Mode when power failure occurs. However, if the UPS device reaches
  low battery before the specified time, the system enters Safe Mode 
immediately.

  In situations where the Synology NAS shuts down during Safe Mode, it will 
automatically turn on when power is restored if you have enabled the
  Restart automatically after a power failure option (located at Control Panel > 
Hardware & Power > General)."


This reads like typical sales literature.  I admit to being none the wiser even 
after reading it several times.


I gather this puts it in a state where it is ready for imminent power loss and 
won’t damage or lose any data.  


How long can this last?  Who supplies the power to the NAS during "Safe mode"?

Ok, I will comment that back out.  That won’t interfere with anything?  What 
user would it run as?  Will it have access to upsmon.conf?


Ubuntu very probably has user nut set up to run NUT and has the permissions set 
accordingly.  If it's possible to execute "command ps -elf | grep nut" in a 
running NAS you will see user nut in action.


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Charles Lepple
On Aug 9, 2020, at 3:18 PM, Todd Benivegna wrote:
> 
> Now they will spin-up on their own, but it takes 5-10 seconds.  My thought 
> was if they can’t communicate initially, they assume the server is dead and 
> shut down.  Would that make sense at all?  

Sorry to jump in the middle here, but this can occur in certain cases, when 
upsmon sees a server go dead *after seeing it go on battery*. See "DEADTIME" 
description: https://networkupstools.org/docs/man/upsmon.conf.html (defaults to 
15 seconds)
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Todd Benivegna
> Since it's NUT in the NAS which is deciding to order the shutdown, it would be
> useful to see upsmon.conf, upssched.conf and upssched-cmd (or whatever 
> Synology
> use if anything) from the NAS to see what criteria they use.
upsmon.conf (on Synology):
RUN_AS_USER root
MONITOR ups@localhost 1 monuser secret master
MINSUPPLIES 1
SHUTDOWNCMD ""
NOTIFYCMD /usr/sbin/upssched
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
NOTIFYFLAG ONLINE EXEC
NOTIFYFLAG ONBATT EXEC
NOTIFYFLAG LOWBATT EXEC
NOTIFYFLAG NOCOMM EXEC
NOTIFYFLAG COMMBAD IGNORE
NOTIFYFLAG COMMOK IGNORE
NOTIFYFLAG SHUTDOWN IGNORE
NOTIFYFLAG FSD EXEC
NOTIFYFLAG NOPARENT SYSLOG
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5

upssched.conf (on Synology):
CMDSCRIPT /usr/syno/bin/synoups
PIPEFN /var/run/upssched.pipe
LOCKFN /var/run/upssched.lock
AT ONLINE * EXECUTE online
AT ONLINE * CANCEL-TIMER fsd
AT LOWBATT * EXECUTE lowbatt
AT NOCOMM * EXECUTE nocomm
AT FSD * EXECUTE fsd
AT ONBATT * EXECUTE onbatt

upssched-cmd (on Synology):
I don’t see this file.  Here are all the files in the ups folder:
nutscan-usb.h  ups.conf  upsd.conf  upsd.users  upsmon.conf  upssched.conf
> What is "Safe mode"?  Is it complete power down?, or some sort of hibernation?
> If it's not a complete power down, how is the hibernation powered?
"When the Synology NAS enters Safe Mode, it stops all services and 
unmounts volumes in order to prevent data loss and shut down (halt for EDS14) 
safely when the UPS device runs out of power. By default, the system enters 
Safe Mode when the UPS device starts running low on power. You can also specify 
the amount of time before the Synology NAS enters Safe Mode when power failure 
occurs. However, if the UPS device reaches low battery before the specified 
time, the system enters Safe Mode immediately.

In situations where the Synology NAS shuts down during Safe Mode, it 
will automatically turn on when power is restored if you have enabled the 
Restart automatically after a power failure option (located at Control Panel > 
Hardware & Power > General)."

I gather this puts it in a state where it is ready for imminent power loss and 
won’t damage or lose any data.  I have enabled “Shutdown UPS when the system 
enter Safe Mode” and I have also enabled “Restart automatically after a power 
failure” as noted above.  I have always had these two options enabled.

Yesterday I recently disabled HDD Advanced Hibernation option as I thought that 
may interfere with NUT on my servers being able to communicate with the NUT 
server on the NAS, hence the immediate shutdown.  Now they will spin-up on 
their own, but it takes 5-10 seconds.  My thought was if they can’t communicate 
initially, they assume the server is dead and shut down.  Would that make sense 
at all?

HDD Hibernation essentially spins down the hard drives when there has been no 
activity.  I had it set at one hour; I have since disabled that setting.  I 
have not ever set the Synology itself to go to sleep or to auto-shutdown.

From the Synology support site:
You can specify the period of time hard disks remain idle before 
entering HDD hibernation mode. During HDD hibernation, hard disks stop 
spinning, reducing power consumption and extending the lifespan of hard disks. 
You can specify different periods of time for internal hard disks and external 
eSATA/USB hard disks.

Phase 1: HDDs power down after a period of inactivity (idle time). You 
may go to DSM > Control Panel > Hardware & Power > HDD Hibernation to configure 
the length of inactivity for the HDDs to enter hibernation.

Phase 2: Advanced Hibernation/Deep Sleep will be implemented for the 
HDDs to further reduce power consumption. You may go to DSM > Control Panel > 
Hardware & Power > HDD Hibernation to enable advanced HDD hibernation.

> You should remove line 1 : RUN_AS_USER nut
Ok, I will comment that back out.  That won’t interfere with anything?  What 
user would it run as?  Will it have access to upsmon.conf?


Thanks,

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 9, 2020, 3:07 AM -0400, Roger Price , wrote:
> On Fri, 7 Aug 2020, Todd Benivegna wrote:
>
> Hello Todd, sorry for the delay replying, I was away for a while. It's ok to
> post configuration files in this list if blank lines and comments are removed.
>
> > On the Synology (I didn’t edit any of these files):
> > ups.conf:  https://hastebin.com/dedereqizi.shell
>
> pollinterval = 5
> [ups]
> driver = usbhid-ups
> port = auto
>
> > upsd.conf:  https://hastebin.com/pupeseweda.css
>
> LISTEN 192.168.1.70
> LISTEN 2601:cf:8200:43d0:211:32ff:fe63:60d7
> LISTEN fe80::211:32ff:fe63:60d7
> LISTEN 127.0.0.1
> LISTEN ::1
>
> > upsd.users:  https://hastebin.com/ocenamecex.cs
>
> [monuser]
> password = secret
> upsmon master
>
> Since it's NUT in the NAS which is deciding to order the shutdown, it would be
> useful to see upsmon.conf, upssched.conf and upssched-cmd (or whatever 
> 

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Roger Price

On Sat, 8 Aug 2020, Todd Benivegna wrote:

I just ran a manual test, killing power and see what happens.  I set the 
Synology “Time before DiskStation goes into Safe mode”


What is "Safe mode"?  Is it complete power down?, or some sort of hibernation? 
If it's not a complete power down, how is the hibernation powered?


to 5 minutes so I didn’t have to wait like an hour until it powered 
down.  Here is the log:


https://hastebin.com/ovuwilufeb.sql

 Aug  8 14:31:01 proton upsmon[1561]: UPS ups@192.168.1.70 on battery
 Aug  8 14:36:01 proton upsmon[1561]: UPS ups@192.168.1.70: forced shutdown in 
progress
 Aug  8 14:36:01 proton upsmon[1561]: Executing automatic power-fail shutdown
 Aug  8 14:36:01 proton upsmon[1561]: Auto logout and shutdown proceeding
 Aug  8 14:36:06 proton upsmon.conf: UPS status [FSD OB DISCHRG]:85

Notice the effect of the upsmon FINALDELAY 5 declaration in the last line. 
Status [FSD OB DISCHRG] is what one would expect in a slave.  I see the UPS has 
lost 15% of it's charge in 5 minutes.


Everything appeared to be normal; the servers powered off and the Synology 
went into safe mode.  Power was then cut to the Synology and my UPS turned 
off.  


I assume power was cut to the Synology because the UPS disconnected it's power 
outlets (often referred to as "UPS turns off").


Could it be something like the Synology drives were in hibernation and the 
Synology wasn’t responding (was probably coming out of hibernation - it takes 
maybe 5-10 seconds) and NUT thought the server was dead and shut everything 
down?  On that note, I did have the Synology set to hibernate/spin down the 
disks after 1 hour, but just disabled that just in case; will be on all the 
time now.  You think that was possibly the problem?


It would be interesting to see what the Synology log says for hibernation, upsd 
and upsmon for a) a manual test, and b) a real wall power failure.


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Roger Price

On Sat, 8 Aug 2020, Todd Benivegna wrote:


Updated upsmon.conf:  https://hastebin.com/jisinaquso.pl


You should remove line 1 : RUN_AS_USER nut

Lines 12-21: it would be possible to display more information, such as the UPS 
status, but this requires pointing NOTIFYCMD to upssched and then using 
a upssched-cmd script to display details of each event.


No, the Synology and the three servers are all on the one UPS (also my switch 
and spare monitor). All these are super low power devices (two Intel NUCs and 
a Raspberry Pi) so at idle the draw like 50-75w and at max load it’s like 
100-150w tops.  UPS is rated for 300w.


In that case, nothing stops you from using one of the "p" Ubuntu machines as the 
master with the Synology NAS as a slave. See 
https://community.synology.com/enu/forum/1/post/119995


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Roger Price

On Fri, 7 Aug 2020, Todd Benivegna wrote:


I don’t think I am able to run that script.  If you can, I wouldn’t know how.


You have to activate SSH on the NAS, log in to the NAS as root (admin) and 
create a temporary directory.  Based on what I read on a french language site, 
the commands are:


 mkdir /volume1/tmp
 cd /volume1/tmp

You can then install the script and run it:

 wget http://rogerprice.org/NUT/nut-report
 ./nut-report

Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Roger Price

On Fri, 7 Aug 2020, Todd Benivegna wrote:

Hello Todd, sorry for the delay replying, I was away for a while. It's ok to 
post configuration files in this list if blank lines and comments are removed.



On the Synology (I didn’t edit any of these files):
ups.conf:  https://hastebin.com/dedereqizi.shell


pollinterval = 5
[ups]
driver = usbhid-ups
port = auto


upsd.conf:  https://hastebin.com/pupeseweda.css


LISTEN 192.168.1.70
LISTEN 2601:cf:8200:43d0:211:32ff:fe63:60d7
LISTEN fe80::211:32ff:fe63:60d7
LISTEN 127.0.0.1
LISTEN ::1


upsd.users:  https://hastebin.com/ocenamecex.cs


[monuser]
password = secret
upsmon master

Since it's NUT in the NAS which is deciding to order the shutdown, it would be 
useful to see upsmon.conf, upssched.conf and upssched-cmd (or whatever Synology 
use if anything) from the NAS to see what criteria they use.


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-08 Thread Todd Benivegna
Roger,

I just ran a manual test, killing power and see what happens.  I set the 
Synology “Time before DiskStation goes into Safe mode” to 5 minutes so I didn’t 
have to wait like an hour until it powered down.  Here is the log:

https://hastebin.com/ovuwilufeb.sql

Everything appeared to be normal; the servers powered off and the Synology went 
into safe mode.  Power was then cut to the Synology and my UPS turned off.  I 
waited a couple minutes, restored power and the UPS came on, the Synology and 
all three servers powered on too.  Everything appears to be perfect.  I just 
don’t understand why in a real power loss situation, that this same thing does 
not apparently happen.  Why would they shut down if power was only out for a 
second?

Could it be something like the Synology drives were in hibernation and the 
Synology wasn’t responding (was probably coming out of hibernation - it takes 
maybe 5-10 seconds) and NUT thought the server was dead and shut everything 
down?  On that note, I did have the Synology set to hibernate/spin down the 
disks after 1 hour, but just disabled that just in case; will be on all the 
time now.  You think that was possibly the problem?

--
Todd Benivegna // t...@benivegna.com
On Aug 8, 2020, 2:12 PM -0400, Todd Benivegna , wrote:
> Roger,
>
> Ok, so how does this look...
>
> Updated upsmon.conf:  https://hastebin.com/jisinaquso.pl
> > I'm guessing that the UPS supplies only the NAS, not the 3 Ubuntu machines. 
> > Do
> > they have their own UPS's?
> No, the Synology and the three servers are all on the one UPS (also my switch 
> and spare monitor). All these are super low power devices (two Intel NUCs and 
> a Raspberry Pi) so at idle the draw like 50-75w and at max load it’s like 
> 100-150w tops.  UPS is rated for 300w.
> > Better:
> >
> >  SHUTDOWNCMD "logger -t upsmon.conf \"UPS status [$( upsc ups@192.168.1.70 
> > ups.status )]:$( upsc ups@192.168.1.70 battery.charge )\" ; /sbin/shutdown 
> > -h +0"
> >
> > I forgot the battery.charge. Roger
> I changed it to this, thanks.
>
> So does everything look good with my config files?  Any thoughts on what may 
> be going on here?  I really wish I could reproduce this, I think that’d make 
> this a lot easier to troubleshoot.
>
> Thanks,
>
> Todd
>
> --
> Todd Benivegna // t...@benivegna.com
> On Aug 8, 2020, 5:12 AM -0400, Roger Price , wrote:
> > On Fri, 7 Aug 2020, Todd Benivegna wrote:
> >
> > > APC Back-UPS NS 650M1 UPS ---USB---> Synology NAS (DS416 - Master?)
> > > ---Ethernet---> Netgear Managed Switch w/ uplink to router <---Ethernet---
> > > Servers (Ubuntu 20.04 - Plex, Pulsar, Proton - All three set as slaves)
> >
> > I'm guessing that the UPS supplies only the NAS, not the 3 Ubuntu machines. 
> > Do
> > they have their own UPS's?
> >
> > > I have all three servers set as slaves, so is the Synology considered the
> > > master?  Or do I need to set one of the servers as the Master?  I've been
> > > under the impression that the Synology is the master, but have been 
> > > unable to
> > > confirm this.
> >
> > I've been looking at the Synology documentation and their NUT setup is not 
> > at
> > all clear. Some of their site is nonsense. I gather from other sites that 
> > the
> > NAS is indeed the master and that upsmon runs in the NAS. This makes sense 
> > if
> > the UPS is for the NAS and nothing else. It also simplifies shutdown if NAS
> > users mount NFS supplied directories in the NAS.
> >
> > > So what I have done so far is enable the "Network UPS Server" on the 
> > > Synology,
> > > entered the three IPs of the servers in there, set it to shutdown when 
> > > battery
> > > is low and enabled "Shutdown UPS when the system enters safe mode".  I 
> > > then
> > > installed NUT on all three servers. In nut.conf I changed MODE to
> > > "MODE=netclient".  I then added my MONITOR line in upsmon.conf. on all 
> > > three.
> > > Looks something like this:
> > >
> > > MONITOR ups@192.168.1.70 1 monuser secret slave
> > >
> > > My SHUTDOWNCMD looks like this:
> > > SHUTDOWNCMD "getUPSstatus ups@192.168.1.70 ; logger -t upsmon.conf \"UPS 
> > > status is $UPSstatus\" ; /sbin/shutdown -h +0"
> >
> > From your previous reports it looks as if getUPSstatus does not work in a
> > SHUTDOWNCMD declaration since the shell variable it creates gets lost. It
> > probably better to declare something like
> >
> > SHUTDOWNCMD "logger -t upsmon.conf \"UPS status [$( upsc ups@192.168.1.70 
> > ups.status )]:$( upsc ups@192.168.1.70 )\" ; /sbin/shutdown -h +0"
> >
> > > I think I've definitely made a mistake though, in that I have not set 
> > > RUN_AS_USER in upsmon.conf
> >
> > The default user is usually set when NUT is built for a specific Linux
> > distribution. I don't know what user Ubuntu have chosen, but I will guess 
> > that
> > they have followed Debian and use "nut". I suggest you do not change this.
> >
> > > and set up the appropriate permissions.
> >
> > Again, I assume Ubuntu build NUT with the correct file 

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-08 Thread Todd Benivegna
Roger,

Ok, so how does this look...

Updated upsmon.conf:  https://hastebin.com/jisinaquso.pl
> I'm guessing that the UPS supplies only the NAS, not the 3 Ubuntu machines. Do
> they have their own UPS's?
No, the Synology and the three servers are all on the one UPS (also my switch 
and spare monitor). All these are super low power devices (two Intel NUCs and a 
Raspberry Pi) so at idle the draw like 50-75w and at max load it’s like 
100-150w tops.  UPS is rated for 300w.
> Better:
>
>  SHUTDOWNCMD "logger -t upsmon.conf \"UPS status [$( upsc ups@192.168.1.70 
> ups.status )]:$( upsc ups@192.168.1.70 battery.charge )\" ; /sbin/shutdown -h 
> +0"
>
> I forgot the battery.charge. Roger
I changed it to this, thanks.

So does everything look good with my config files?  Any thoughts on what may be 
going on here?  I really wish I could reproduce this, I think that’d make this 
a lot easier to troubleshoot.

Thanks,

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 8, 2020, 5:12 AM -0400, Roger Price , wrote:
> On Fri, 7 Aug 2020, Todd Benivegna wrote:
>
> > APC Back-UPS NS 650M1 UPS ---USB---> Synology NAS (DS416 - Master?)
> > ---Ethernet---> Netgear Managed Switch w/ uplink to router <---Ethernet---
> > Servers (Ubuntu 20.04 - Plex, Pulsar, Proton - All three set as slaves)
>
> I'm guessing that the UPS supplies only the NAS, not the 3 Ubuntu machines. Do
> they have their own UPS's?
>
> > I have all three servers set as slaves, so is the Synology considered the
> > master?  Or do I need to set one of the servers as the Master?  I've been
> > under the impression that the Synology is the master, but have been unable 
> > to
> > confirm this.
>
> I've been looking at the Synology documentation and their NUT setup is not at
> all clear. Some of their site is nonsense. I gather from other sites that the
> NAS is indeed the master and that upsmon runs in the NAS. This makes sense if
> the UPS is for the NAS and nothing else. It also simplifies shutdown if NAS
> users mount NFS supplied directories in the NAS.
>
> > So what I have done so far is enable the "Network UPS Server" on the 
> > Synology,
> > entered the three IPs of the servers in there, set it to shutdown when 
> > battery
> > is low and enabled "Shutdown UPS when the system enters safe mode".  I then
> > installed NUT on all three servers. In nut.conf I changed MODE to
> > "MODE=netclient".  I then added my MONITOR line in upsmon.conf. on all 
> > three.
> > Looks something like this:
> >
> > MONITOR ups@192.168.1.70 1 monuser secret slave
> >
> > My SHUTDOWNCMD looks like this:
> > SHUTDOWNCMD "getUPSstatus ups@192.168.1.70 ; logger -t upsmon.conf \"UPS 
> > status is $UPSstatus\" ; /sbin/shutdown -h +0"
>
> From your previous reports it looks as if getUPSstatus does not work in a
> SHUTDOWNCMD declaration since the shell variable it creates gets lost. It
> probably better to declare something like
>
> SHUTDOWNCMD "logger -t upsmon.conf \"UPS status [$( upsc ups@192.168.1.70 
> ups.status )]:$( upsc ups@192.168.1.70 )\" ; /sbin/shutdown -h +0"
>
> > I think I've definitely made a mistake though, in that I have not set 
> > RUN_AS_USER in upsmon.conf
>
> The default user is usually set when NUT is built for a specific Linux
> distribution. I don't know what user Ubuntu have chosen, but I will guess that
> they have followed Debian and use "nut". I suggest you do not change this.
>
> > and set up the appropriate permissions.
>
> Again, I assume Ubuntu build NUT with the correct file permissions for their
> default user.
>
> Roger
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-08 Thread Roger Price

On Fri, 7 Aug 2020, Todd Benivegna wrote:

APC Back-UPS NS 650M1 UPS ---USB---> Synology NAS (DS416 - Master?) 
---Ethernet---> Netgear Managed Switch w/ uplink to router <---Ethernet--- 
Servers (Ubuntu 20.04 - Plex, Pulsar, Proton - All three set as slaves)


I'm guessing that the UPS supplies only the NAS, not the 3 Ubuntu machines.  Do 
they have their own UPS's?


I have all three servers set as slaves, so is the Synology considered the 
master?  Or do I need to set one of the servers as the Master?  I've been 
under the impression that the Synology is the master, but have been unable to 
confirm this.


I've been looking at the Synology documentation and their NUT setup is not at 
all clear.  Some of their site is nonsense.  I gather from other sites that the 
NAS is indeed the master and that upsmon runs in the NAS. This makes sense if 
the UPS is for the NAS and nothing else.  It also simplifies shutdown if NAS 
users mount NFS supplied directories in the NAS.


So what I have done so far is enable the "Network UPS Server" on the Synology, 
entered the three IPs of the servers in there, set it to shutdown when battery 
is low and enabled "Shutdown UPS when the system enters safe mode".  I then 
installed NUT on all three servers. In nut.conf I changed MODE to 
"MODE=netclient".  I then added my MONITOR line in upsmon.conf. on all three.  
Looks something like this:  


MONITOR ups@192.168.1.70 1 monuser secret slave

My SHUTDOWNCMD looks like this:
SHUTDOWNCMD "getUPSstatus ups@192.168.1.70 ; logger -t upsmon.conf \"UPS status is 
$UPSstatus\" ; /sbin/shutdown -h +0"  


From your previous reports it looks as if getUPSstatus does not work in a 
SHUTDOWNCMD declaration since the shell variable it creates gets lost. It 
probably better to declare something like


 SHUTDOWNCMD "logger -t upsmon.conf \"UPS status [$( upsc ups@192.168.1.70 ups.status 
)]:$( upsc ups@192.168.1.70 )\" ; /sbin/shutdown -h +0"  


I think I've definitely made a mistake though, in that I have not set 
RUN_AS_USER in upsmon.conf


The default user is usually set when NUT is built for a specific Linux 
distribution.  I don't know what user Ubuntu have chosen, but I will guess that 
they have followed Debian and use "nut".  I suggest you do not change this.



and set up the appropriate permissions.


Again, I assume Ubuntu build NUT with the correct file permissions for their 
default user.


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-07 Thread Todd Benivegna
upsmon.conf on server:  https://pastebin.com/z4CrUTxb
nut.conf on server:  https://pastebin.com/540ShZH7
Permissions for /etc/nut:  https://hastebin.com/qecolodapi.diff

On the Synology (I didn’t edit any of these files):
ups.conf:  https://hastebin.com/dedereqizi.shell
upsd.conf:  https://hastebin.com/pupeseweda.css
upsd.users:  https://hastebin.com/ocenamecex.cs

I don’t think I am able to run that script.  If you can, I wouldn’t know how.

Please let me know what you think.

Thanks for all the help!

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 7, 2020, 12:14 PM -0400, Todd Benivegna , wrote:
> Hi Roger,
>
> I am not home, but when I do get home I will check out everything you've 
> mentioned.  I do have some time where I can give you a breakdown of my 
> topology though.  I have a feeling all of this is probably due to a 
> configuration error somewhere on my part.   Here's what I have done so far.
>
> APC Back-UPS NS 650M1 UPS ---USB---> Synology NAS (DS416 - Master?) 
> ---Ethernet---> Netgear Managed Switch w/ uplink to router <---Ethernet--- 
> Servers (Ubuntu 20.04 - Plex, Pulsar, Proton - All three set as slaves)
>
> I have all three servers set as slaves, so is the Synology considered the 
> master?  Or do I need to set one of the servers as the Master?  I've been 
> under the impression that the Synology is the master, but have been unable to 
> confirm this.
>
> So what I have done so far is enable the "Network UPS Server" on the 
> Synology, entered the three IPs of the servers in there, set it to shutdown 
> when battery is low and enabled "Shutdown UPS when the system enters safe 
> mode".  I then installed NUT on all three servers. In nut.conf I changed MODE 
> to "MODE=netclient".  I then added my MONITOR line in upsmon.conf. on all 
> three.  Looks something like this:
>
> MONITOR ups@192.168.1.70 1 monuser secret slave
>
> My SHUTDOWNCMD looks like this:
>
> SHUTDOWNCMD "getUPSstatus ups@192.168.1.70 ; logger -t upsmon.conf \"UPS 
> status is $UPSstatus\" ; /sbin/shutdown -h +0"
>
> Would that not work?  I believe that's what you told me to put there.
>
> I think I've definitely made a mistake though, in that I have not set 
> RUN_AS_USER in upsmon.conf and set up the appropriate permissions.  I read 
> somewhere that it would then run as user NOBODY and not be able read 
> upsmon.conf.  Is that true?  Could that be the whole problem?
>
> I'm thinking I need to put in..
>
> RUN_AS_USER nut
>
> in upsmon.conf and then do:
>
> $ sudo chown -R root:nut /etc/nut
> $ sudo chmod 0770 /etc/nut
> $ sudo chmod 0640 /etc/nut/*
>
> Does that last part look correct to you?  I think what I will do is put the 
> contents of the files in pastebin and send the links to you.  May be easier 
> that way.
>
> Thanks,
>
> Todd
>
> > On Fri, Aug 7, 2020 at 5:47 AM Roger Price  wrote:
> > > On Thu, 6 Aug 2020, Todd Benivegna wrote:
> > >
> > > > ... I grep’d the syslog and here’s the results:
> > >
> > > Could you also grep for upsd and upsmon in the NAS log?  Is this possible?
> > >
> > > >       proton@proton:~$ sudo grep upsmon /var/log/syslog
> > > >       Aug  6 19:19:09 proton upsmon[1552]: UPS ups@192.168.1.70 on 
> > > >battery
> > > >       Aug  6 19:19:14 proton upsmon[1552]: UPS ups@192.168.1.70 on line 
> > > >power
> > > >       Aug  6 19:19:44 proton upsmon[1552]: UPS ups@192.168.1.70: forced 
> > > >shutdown in progress
> > > >       Aug  6 19:19:44 proton upsmon[1552]: Executing automatic 
> > > >power-fail shutdown
> > >
> > > So proton is a slave, and is being made to shut down.
> > >
> > > >       Aug  6 19:19:45 proton upsmon[1552]: Auto logout and shutdown 
> > > >proceeding
> > > >       Aug  6 19:19:50 proton upsmon.conf: UPS status is
> > >
> > > The variable USPstatus set by getUPSstatus was not in the environment for 
> > > the
> > > echo command.  To get this to work, you'll have to put the upsc commands
> > > directly in SHUTDOWNCMD, or create a short script and call the script in
> > > SHUTDOWNCMD.
> > >
> > > >       Aug  6 19:19:59 proton upsmon[1545]: UPS: ups@192.168.1.70 
> > > >(slave) (power value 1)
> > >
> > > Could you tell us your topology?  Which system is master and which is 
> > > slave?
> > > Do you have multiple slaves?  The decision to shutdown is taken by the 
> > > master,
> > > not the slave.
> > >
> > > Is it possible to run script http://rogerprice.org/NUT/nut-report on the 
> > > NAS?
> > > Could you run the script on one of the slaves and post the result here?
> > >
> > > Roger___
> > > Nut-upsuser mailing list
> > > Nut-upsuser@alioth-lists.debian.net
> > > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
>
> --
> Todd Benivegna // t...@benivegna.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-07 Thread Todd Benivegna
Hi Roger,

I am not home, but when I do get home I will check out everything you've
mentioned.  I do have some time where I can give you a breakdown of my
topology though.  I have a feeling all of this is probably due to a
configuration error somewhere on my part.   Here's what I have done so far.

*APC Back-UPS NS 650M1 UPS* ---USB---> *Synology NAS (DS416 - Master?)*
---Ethernet---> *Netgear Managed Switch* w/ uplink to router
<---Ethernet--- *Servers (Ubuntu 20.04 - Plex, Pulsar, Proton - All three
set as slaves)*

I have all three servers set as slaves, so is the Synology considered the
master?  Or do I need to set one of the servers as the Master?  I've been
under the impression that the Synology is the master, but have been unable
to confirm this.

So what I have done so far is enable the "Network UPS Server" on the
Synology, entered the three IPs of the servers in there, set it to shutdown
when battery is low and enabled "Shutdown UPS when the system enters safe
mode".  I then installed NUT on all three servers. In nut.conf I changed
MODE to "MODE=netclient".  I then added my MONITOR line in upsmon.conf. on
all three.  Looks something like this:

MONITOR ups@192.168.1.70 1 monuser secret slave

My SHUTDOWNCMD looks like this:

SHUTDOWNCMD "getUPSstatus ups@192.168.1.70 ; logger -t upsmon.conf \"UPS
status is $UPSstatus\" ; /sbin/shutdown -h +0"

Would that not work?  I believe that's what you told me to put there.

I think I've definitely made a mistake though, in that I have not
set RUN_AS_USER in upsmon.conf and set up the appropriate permissions.  I
read somewhere that it would then run as user NOBODY and not be able read
upsmon.conf.  Is that true?  Could that be the whole problem?

I'm thinking I need to put in..

RUN_AS_USER nut

in upsmon.conf and then do:

$ sudo chown -R root:nut /etc/nut
$ sudo chmod 0770 /etc/nut
$ sudo chmod 0640 /etc/nut/*

Does that last part look correct to you?  I think what I will do is put the
contents of the files in pastebin and send the links to you.  May be easier
that way.

Thanks,

Todd

On Fri, Aug 7, 2020 at 5:47 AM Roger Price  wrote:

> On Thu, 6 Aug 2020, Todd Benivegna wrote:
>
> > ... I grep’d the syslog and here’s the results:
>
> Could you also grep for upsd and upsmon in the NAS log?  Is this possible?
>
> >   proton@proton:~$ sudo grep upsmon /var/log/syslog
> >   Aug  6 19:19:09 proton upsmon[1552]: UPS ups@192.168.1.70 on
> battery
> >   Aug  6 19:19:14 proton upsmon[1552]: UPS ups@192.168.1.70 on line
> power
> >   Aug  6 19:19:44 proton upsmon[1552]: UPS ups@192.168.1.70: forced
> shutdown in progress
> >   Aug  6 19:19:44 proton upsmon[1552]: Executing automatic
> power-fail shutdown
>
> So proton is a slave, and is being made to shut down.
>
> >   Aug  6 19:19:45 proton upsmon[1552]: Auto logout and shutdown
> proceeding
> >   Aug  6 19:19:50 proton upsmon.conf: UPS status is
>
> The variable USPstatus set by getUPSstatus was not in the environment for
> the
> echo command.  To get this to work, you'll have to put the upsc commands
> directly in SHUTDOWNCMD, or create a short script and call the script in
> SHUTDOWNCMD.
>
> >   Aug  6 19:19:59 proton upsmon[1545]: UPS: ups@192.168.1.70
> (slave) (power value 1)
>
> Could you tell us your topology?  Which system is master and which is
> slave?
> Do you have multiple slaves?  The decision to shutdown is taken by the
> master,
> not the slave.
>
> Is it possible to run script http://rogerprice.org/NUT/nut-report on the
> NAS?
> Could you run the script on one of the slaves and post the result here?
>
> Roger___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser



-- 
*Todd Benivegna* // t...@benivegna.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-07 Thread Roger Price

On Fri, 7 Aug 2020, Roger Price wrote:


Is it possible to run script http://rogerprice.org/NUT/nut-report on the NAS?


No need, it's sufficient to tell us the contents of files upsd.conf, upsd.users 
and ups.conf probably in DS416 directory /usr/syno/etc/ups . Remove your 
passwords, and please remove comments and blank lines. A command such as


 grep ^[^#] upsd.conf

will do the job.

It's implicit in the Synology documentation I've read that upsmon never runs on 
a Synology NAS.  Is this true?


It would still be nice to see the output of the nut-report script for your 
master Ubuntu box.


Roger

___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-07 Thread Roger Price

On Thu, 6 Aug 2020, Todd Benivegna wrote:


... I grep’d the syslog and here’s the results:


Could you also grep for upsd and upsmon in the NAS log?  Is this possible?


  proton@proton:~$ sudo grep upsmon /var/log/syslog
  Aug  6 19:19:09 proton upsmon[1552]: UPS ups@192.168.1.70 on battery
  Aug  6 19:19:14 proton upsmon[1552]: UPS ups@192.168.1.70 on line power
  Aug  6 19:19:44 proton upsmon[1552]: UPS ups@192.168.1.70: forced 
shutdown in progress
  Aug  6 19:19:44 proton upsmon[1552]: Executing automatic power-fail 
shutdown


So proton is a slave, and is being made to shut down.


  Aug  6 19:19:45 proton upsmon[1552]: Auto logout and shutdown proceeding
  Aug  6 19:19:50 proton upsmon.conf: UPS status is 


The variable USPstatus set by getUPSstatus was not in the environment for the 
echo command.  To get this to work, you'll have to put the upsc commands 
directly in SHUTDOWNCMD, or create a short script and call the script in 
SHUTDOWNCMD.



  Aug  6 19:19:59 proton upsmon[1545]: UPS: ups@192.168.1.70 (slave) (power 
value 1)


Could you tell us your topology?  Which system is master and which is slave? 
Do you have multiple slaves?  The decision to shutdown is taken by the master, 
not the slave.


Is it possible to run script http://rogerprice.org/NUT/nut-report on the NAS? 
Could you run the script on one of the slaves and post the result here?


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-06 Thread Todd Benivegna
Ok guys,

So we just had a storm roll through and of course we lost power for just a 
split second.  This time I was actually home for it.  Sure enough, the servers 
shutdown and wouldn’t boot all the way up until I restarted my Synology.  I 
grep’d the syslog and here’s the results:
> proton@proton:~$ sudo grep upsmon /var/log/syslog
> Aug  6 19:19:09 proton upsmon[1552]: UPS ups@192.168.1.70 on battery
> Aug  6 19:19:14 proton upsmon[1552]: UPS ups@192.168.1.70 on line power
> Aug  6 19:19:44 proton upsmon[1552]: UPS ups@192.168.1.70: forced shutdown in 
> progress
> Aug  6 19:19:44 proton upsmon[1552]: Executing automatic power-fail shutdown
> Aug  6 19:19:45 proton upsmon[1552]: Auto logout and shutdown proceeding
> Aug  6 19:19:50 proton upsmon.conf: UPS status is
> Aug  6 19:19:59 proton upsmon[1545]: fopen /run/nut/upsmon.pid: No such file 
> or directory
> Aug  6 19:19:59 proton upsmon[1545]: UPS: ups@192.168.1.70 (slave) (power 
> value 1)
> Aug  6 19:19:59 proton upsmon[1545]: Using power down flag file /etc/killpower
> Aug  6 19:19:59 proton systemd[1]: nut-monitor.service: Can't open PID file 
> /run/nut/upsmon.pid (yet?) after start: Operation not permitted
> Aug  6 19:19:59 proton upsmon[1557]: Startup successful
> Aug  6 19:19:59 proton upsmon[1558]: UPS [ups@192.168.1.70]: connect failed: 
> Connection failure: Network is unreachable
> Aug  6 19:19:59 proton upsmon[1558]: Communications with UPS ups@192.168.1.70 
> lost
> Aug  6 19:20:04 proton upsmon[1558]: UPS [ups@192.168.1.70]: connect failed: 
> Connection failure: Network is unreachable
> Aug  6 19:20:04 proton upsmon[1558]: UPS ups@192.168.1.70 is unavailable
> Aug  6 19:28:03 proton upsmon[1558]: Communications with UPS ups@192.168.1.70 
> established

> proton@proton:~$ sudo upsc UPS@192.168.1.70
> Init SSL without certificate database
> battery.charge: 100
> battery.charge.low: 10
> battery.charge.warning: 50
> battery.date: 2001/09/25
> battery.mfr.date: 2016/12/11
> battery.runtime: 2076
> battery.runtime.low: 120
> battery.type: PbAc
> battery.voltage: 13.6
> battery.voltage.nominal: 12.0
> device.mfr: American Power Conversion
> device.model: Back-UPS NS 650M1
> device.serial: 4B1650P02109
> device.type: ups
> driver.name: usbhid-ups
> driver.parameter.pollfreq: 30
> driver.parameter.pollinterval: 5
> driver.parameter.port: auto
> driver.version: DSM6-2-25364-191230
> driver.version.data: APC HID 0.95
> driver.version.internal: 0.38
> input.sensitivity: medium
> input.transfer.high: 139
> input.transfer.low: 92
> input.transfer.reason: input voltage out of range
> input.voltage: 121.0
> input.voltage.nominal: 120
> ups.beeper.status: enabled
> ups.delay.shutdown: 20
> ups.firmware: 929.a5 .D USB FW
> ups.load: 15
> ups.mfr: American Power Conversion
> ups.mfr.date: 2016/12/11
> ups.model: Back-UPS NS 650M1
> ups.productid: 0002
> ups.realpower.nominal: 360
> ups.serial: 4B1650P02109
> ups.status: OL
> ups.test.result: No test initiated
> ups.timer.reboot: 0
> ups.timer.shutdown: -1
> ups.vendorid: 051d

Looks like what we did earlier didn’t work as it just says “UPS Status is” with 
nothing after it.  Also after grep’d the syslog I got the current status of the 
UPS.

What do you think?  I really just don’t understand what the heck is going on.  
Like I said before, whenever I test manually it works!  This is crazy.

Thanks for all your help,

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 5, 2020, 7:29 AM -0400, Todd Benivegna , wrote:
> > grep nut /etc/passwd
>
> nut:x:129:134::/var/lib/nut:/usr/sbin/nologin
>
> > In your manual test do you restore utility power after 3-5 seconds?
> Yes, I have tried that.  I have also tried less than one second.  I’ve tried 
> for 1-2 minutes, for 3-5 minutes, I’ve tried just about every length of time 
> and all appears Ok when I manually test.
>
> --
> Todd Benivegna // t...@benivegna.com
> On Aug 5, 2020, 3:26 AM -0400, Roger Price , wrote:
> > On Tue, 4 Aug 2020, Todd Benivegna wrote:
> >
> > > Sorry. I've lost the thread here, what is the "it" you refer to?
> > >
> > > I’m not an linux expert so you’ll have to bear with me, but I guess the 
> > > it I
> > > was referring to whatever NUT is using since what we’re editing is a 
> > > config
> > > file, not a script; it doesn’t have a shebang at the top.
> >
> > The command sequence specified by the SHUTDOWNCMD declaration is called from
> > upsmon (a program written in C).
> >
> > > If you run the command
> > > grep nut /etc/password
> > >
> > > I got:  grep: /etc/password: No such file or directory
> >
> > Sorry, my mistake it should be
> >
> > grep nut /etc/passwd
> >
> > > That may seem to be the case, however, whenever I test by manually 
> > > pulling the
> > > power, the servers stay up and all appears normal.  It has happened three
> > > times now where I am away and the power goes out for 3-5 seconds and the
> > > servers shutdown and will stay down, even if I try to power back on, 
> > > until I
> > > restart the Synology 

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-05 Thread Todd Benivegna
> grep nut /etc/passwd

nut:x:129:134::/var/lib/nut:/usr/sbin/nologin

> In your manual test do you restore utility power after 3-5 seconds?
Yes, I have tried that.  I have also tried less than one second.  I’ve tried 
for 1-2 minutes, for 3-5 minutes, I’ve tried just about every length of time 
and all appears Ok when I manually test.

--
Todd Benivegna // t...@benivegna.com
On Aug 5, 2020, 3:26 AM -0400, Roger Price , wrote:
> On Tue, 4 Aug 2020, Todd Benivegna wrote:
>
> > Sorry. I've lost the thread here, what is the "it" you refer to?
> >
> > I’m not an linux expert so you’ll have to bear with me, but I guess the it I
> > was referring to whatever NUT is using since what we’re editing is a config
> > file, not a script; it doesn’t have a shebang at the top.
>
> The command sequence specified by the SHUTDOWNCMD declaration is called from
> upsmon (a program written in C).
>
> > If you run the command
> > grep nut /etc/password
> >
> > I got:  grep: /etc/password: No such file or directory
>
> Sorry, my mistake it should be
>
> grep nut /etc/passwd
>
> > That may seem to be the case, however, whenever I test by manually pulling 
> > the
> > power, the servers stay up and all appears normal.  It has happened three
> > times now where I am away and the power goes out for 3-5 seconds and the
> > servers shutdown and will stay down, even if I try to power back on, until I
> > restart the Synology NAS.
>
> In your manual test do you restore utility power after 3-5 seconds?
>
> Roger
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-05 Thread Roger Price

On Tue, 4 Aug 2020, Todd Benivegna wrote:


  Sorry. I've lost the thread here, what is the "it" you refer to?

I’m not an linux expert so you’ll have to bear with me, but I guess the it I 
was referring to whatever NUT is using since what we’re editing is a config 
file, not a script; it doesn’t have a shebang at the top.


The command sequence specified by the SHUTDOWNCMD declaration is called from 
upsmon (a program written in C).



  If you run the command
  grep nut /etc/password

I got:  grep: /etc/password: No such file or directory


Sorry, my mistake it should be

 grep nut /etc/passwd

That may seem to be the case, however, whenever I test by manually pulling the 
power, the servers stay up and all appears normal.  It has happened three 
times now where I am away and the power goes out for 3-5 seconds and the 
servers shutdown and will stay down, even if I try to power back on, until I 
restart the Synology NAS.


In your manual test do you restore utility power after 3-5 seconds?

Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-04 Thread Todd Benivegna
> Sorry. I've lost the thread here, what is the "it" you refer to?
I’m not an linux expert so you’ll have to bear with me, but I guess the it I 
was referring to whatever NUT is using since what we’re editing is a config 
file, not a script; it doesn’t have a shebang at the top.

> If you run the command
>
> grep nut /etc/password
I got:  grep: /etc/password: No such file or directory

> can be seen on
> a Debian box with the command
>
> ls -alF /bin/sh
I got:  lrwxrwxrwx 1 root root 4 Apr 23 11:02 /bin/sh -> dash*


Also I did "echo $SHELL" in a terminal window and got "/bin/bash”.  So what I 
found earlier is true; Bash is used in the Terminal app and Dash is used for 
scripts.

So anyway, I guess that means that it is using Dash then, correct?

Ok, so I copied the getUPSstatus function in .profile as well.  So it has been 
added to both .bashrc and .profile and I have added...

SHUTDOWNCMD "getUPSstatus ups@192.168.1.70 ; logger -t upsmon.conf \"UPS status 
is $UPSstatus\" ; /sbin/shutdown -h +0"

…to my upsmon.conf.  So I think I should be go to go for the next time this 
happens; should get some more information as to what is going on.

Also, I was thinking about your suggestion, Manuel, to use Wireshark as well.  
You mentioned,
> My first suspect is the Synology version of nut. More specifically, I suspect 
> that nut triggers a shutdown immediately after the switch to "on battery" 
> state and only cancels it after a restart.
That may seem to be the case, however, whenever I test by manually pulling the 
power, the servers stay up and all appears normal.  It has happened three times 
now where I am away and the power goes out for 3-5 seconds and the servers 
shutdown and will stay down, even if I try to power back on, until I restart 
the Synology NAS.

Thanks for both your guys’ help with everything so far…. I really appreciate it.

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 4, 2020, 2:38 PM -0400, Roger Price , wrote:
> On Tue, 4 Aug 2020, Todd Benivegna wrote:
>
> > Right, but I don't know what NUT script is actually calling it.  I don't 
> > know how else I would check.
>
> Sorry. I've lost the thread here, what is the "it" you refer to?
>
> If you run the command
>
> grep nut /etc/password
>
> you will probably receive a reply similar to
>
> nut:x:121:126::/var/lib/nut:/bin/false
>
> The /bin/false implies that user nut uses the default shell which can be seen 
> on
> a Debian box with the command
>
> ls -alF /bin/sh
> lrwxrwxrwx 1 root root 4 Jan 24 2017 /bin/sh -> dash*
>
> This says that Dash is the default for the command line and for scripts. As
> Manuel has said this can be changed with the first line of a script, e.g.
>
> #!/bin/bash
>
> says that this script uses Bash.
>
> Roger
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-04 Thread Roger Price

On Tue, 4 Aug 2020, Todd Benivegna wrote:


Right, but I don't know what NUT script is actually calling it.  I don't know 
how else I would check.


Sorry. I've lost the thread here, what is the "it" you refer to?

If you run the command

 grep nut /etc/password

you will probably receive a reply similar to

 nut:x:121:126::/var/lib/nut:/bin/false

The /bin/false implies that user nut uses the default shell which can be seen on 
a Debian box with the command


 ls -alF /bin/sh
 lrwxrwxrwx 1 root root 4 Jan 24  2017 /bin/sh -> dash*

This says that Dash is the default for the command line and for scripts.  As 
Manuel has said this can be changed with the first line of a script, e.g.


 #!/bin/bash

says that this script uses Bash.

Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-04 Thread Manuel Wolfshant

On 8/4/20 5:43 PM, Todd Benivegna wrote:
Right, but I don't know what NUT script is actually calling it.  I 
don't know how else I would check.



you could

-   use SHUTDOWNCMD ="|echo $SHELL > /tmp/WhatShellIsInUse" and check 
the content of that file after a shutdown is triggered

|

|- proceed as you suggested earlier and add the same function in dash's 
initialization file|


|- place all the commands suggested by Roger ( including the function 
itself ) in a standard script saved on disk ( as a file ) and invoke 
that script from the shutdown command|


|
|

||

On Tue, Aug 4, 2020 at 10:21 AM Manuel Wolfshant 
mailto:wo...@nobugconsulting.ro>> wrote:


On 8/4/20 4:16 PM, Todd Benivegna wrote:
> Ok, so now that I think of it, that might not actually work when
it is
> not run by me.  I guess that it all confirms that it works in Bash,
> but I think when it runs on its own it would use Dash...

it uses whatever shell you ask for in the first line of the script






___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-04 Thread Todd Benivegna
Right, but I don't know what NUT script is actually calling it.  I don't
know how else I would check.

On Tue, Aug 4, 2020 at 10:21 AM Manuel Wolfshant 
wrote:

> On 8/4/20 4:16 PM, Todd Benivegna wrote:
> > Ok, so now that I think of it, that might not actually work when it is
> > not run by me.  I guess that it all confirms that it works in Bash,
> > but I think when it runs on its own it would use Dash...
>
> it uses whatever shell you ask for in the first line of the script
>
>
>
>
>
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser



-- 
*Todd Benivegna* // t...@benivegna.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-04 Thread Manuel Wolfshant

On 8/4/20 4:16 PM, Todd Benivegna wrote:
Ok, so now that I think of it, that might not actually work when it is 
not run by me.  I guess that it all confirms that it works in Bash, 
but I think when it runs on its own it would use Dash...


it uses whatever shell you ask for in the first line of the script





___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-04 Thread Todd Benivegna
Ok, so now that I think of it, that might not actually work when it is not
run by me.  I guess that it all confirms that it works in Bash, but I think
when it runs on its own it would use Dash...

The default login shell remains bash. Opening a terminal from the menu or
> shortcut [crtl-alt-t] provides interactive bash. A script run from the
> desktop or file manager, through the dialogue 'run in terminal' will
> execute as POSIX dash.

https://wiki.ubuntu.com/DashAsBinSh

So I would need to put the function in .profile then, right?  Could I leave
it in both .bashrc and .profile so it'd work either way?

On Tue, Aug 4, 2020 at 8:39 AM Todd Benivegna  wrote:

> Ok, gotcha, I did that. I believe Ubuntu uses Bash for user sessions and
> Dash fornscripts, so followed your instructions for Dash. I put the
> getUPStatus bits in .bashrc and tested in Terminal and got:
>
> UPS status is [OL]:100
>
> So I went ahead and put your SHUTDOWNCMD in upsmon.conf. I think it should
> be working now
>
> --
>
> *Todd Benivegna* // t...@benivegna.com
> On Aug 4, 2020, 3:13 AM -0400, Roger Price , wrote:
>
> On Mon, 3 Aug 2020, Todd Benivegna wrote:
>
> Thank you!  Sorry for another bonehead question…. Do I replace  with
> the IP address of the NUT Server/Synology?  I’m assuming I would use this
> version for use in Dash with Ubuntu, correct?
>
>
> Yes, you replace  with the address of your UPS, for example
> "ups@192.168.x.y". Are you using Dash or Bash? If it's Dash, the function
> getUPSstatus probably goes into .profile .
>
> Test on the command line before modifying SHUTDOWNCMD by typing the
> commands
>
> getUPSstatus 
> echo "UPS status is $UPSstatus"
>
> You should see "UPS status is [OL]:100".
>
> Roger
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
>

-- 
*Todd Benivegna* // t...@benivegna.com
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-04 Thread Todd Benivegna
Ok, gotcha, I did that. I believe Ubuntu uses Bash for user sessions and Dash 
fornscripts, so followed your instructions for Dash. I put the getUPStatus bits 
in .bashrc and tested in Terminal and got:

UPS status is [OL]:100

So I went ahead and put your SHUTDOWNCMD in upsmon.conf. I think it should be 
working now

--
Todd Benivegna // t...@benivegna.com
On Aug 4, 2020, 3:13 AM -0400, Roger Price , wrote:
> On Mon, 3 Aug 2020, Todd Benivegna wrote:
>
> > Thank you!  Sorry for another bonehead question…. Do I replace  with
> > the IP address of the NUT Server/Synology?  I’m assuming I would use this
> > version for use in Dash with Ubuntu, correct?
>
> Yes, you replace  with the address of your UPS, for example
> "ups@192.168.x.y". Are you using Dash or Bash? If it's Dash, the function
> getUPSstatus probably goes into .profile .
>
> Test on the command line before modifying SHUTDOWNCMD by typing the commands
>
> getUPSstatus 
> echo "UPS status is $UPSstatus"
>
> You should see "UPS status is [OL]:100".
>
> Roger
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-04 Thread Roger Price

On Mon, 3 Aug 2020, Todd Benivegna wrote:

Thank you!  Sorry for another bonehead question…. Do I replace  with 
the IP address of the NUT Server/Synology?  I’m assuming I would use this 
version for use in Dash with Ubuntu, correct?


Yes, you replace  with the address of your UPS, for example 
"ups@192.168.x.y".  Are you using Dash or Bash?  If it's Dash, the function 
getUPSstatus probably goes into .profile .


Test on the command line before modifying SHUTDOWNCMD by typing the commands

 getUPSstatus 
 echo "UPS status is $UPSstatus"

You should see "UPS status is [OL]:100".

Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-03 Thread Todd Benivegna
Thank you!  Sorry for another bonehead question…. Do I replace  with the 
IP address of the NUT Server/Synology?  I’m assuming I would use this version 
for use in Dash with Ubuntu, correct?

--
Todd Benivegna // t...@benivegna.com
On Aug 3, 2020, 5:33 AM -0400, Roger Price , wrote:
> On Sun, 2 Aug 2020, Todd Benivegna wrote:
>
> > How would you write the SHUTDOWNCMD line with multiple commands?  I’ve been
> > looking at the manual and see that you have to escape the internal “ but am
> > still a little confused on how to do this exactly.
>
> This assumes that you use the Bash shell in your default environment. It will
> need adaption if you use Dash.
>
> In .bashrc define function getUPSstatus
>
> # Update variable UPSstatus and export to environment
> # Usage getUPSstatus 
> function getUPSstatus {
> export UPSstatus="[$( upsc $1 ups.status 2>/dev/null )]:$( upsc $1 
> battery.charge 2>/dev/null )"
> }
>
> The SHUTDOWNCMD declaration now simplifies to
>
> SHUTDOWNCMD "getUPSstatus  ; logger -t upsmon.conf \"UPS status is 
> $UPSstatus\" ; /sbin/shutdown -h +0"
>
> Roger
> ___
> Nut-upsuser mailing list
> Nut-upsuser@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-03 Thread Roger Price

On Sun, 2 Aug 2020, Todd Benivegna wrote:

How would you write the SHUTDOWNCMD line with multiple commands?  I’ve been 
looking at the manual and see that you have to escape the internal “ but am

still a little confused on how to do this exactly.


This assumes that you use the Bash shell in your default environment.  It will 
need adaption if you use Dash.


In .bashrc define function getUPSstatus

 # Update variable UPSstatus and export to environment
 # Usage getUPSstatus 
 function getUPSstatus {
   export UPSstatus="[$( upsc $1 ups.status 2>/dev/null )]:$( upsc $1 battery.charge 
2>/dev/null )"
 }

The SHUTDOWNCMD declaration now simplifies to

 SHUTDOWNCMD "getUPSstatus  ; logger -t upsmon.conf \"UPS status is 
$UPSstatus\" ; /sbin/shutdown -h +0"

Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser