On Thu, 8 Jun 2017, Robbie van der Walle wrote:> The "upsrw" command contacts upsd, so it sounds like you should be able to add a user to upsd.users on the NAS, and then run something like > this on the Mac: > > ??upsrw -s battery.charge.low=80 -u upsmaster -s sekret UPS at synology > > Per?http://networkupstools.org/docs/man/upsd.users.html?, the "upsmaster" user would need at least "actions = SET". You will need to reload > upsd after changing upsd.users. > > I managed to do this, upsc reports:? > > battery.charge.low: 80 instead of 10? > What is the purpose of changing this value?When you carry out tests to ensure that the setup is working well, you will pull the power cord from the wall and wait until the UPS reaches LB. This means waiting and wasting time. You can speed up the testing by setting LB very high so that the UPS reaches it quickly. Later you can set a more reasonable value.> If the UPS is not turning itself off after the NAS goes into safe mode, it might be possible to do this from the Mac. You probably have > something like this in the Mac's upsmon.conf: > > ??SHUTDOWNCMD "/sbin/shutdown -h +0" > > You could add an UPS shutdown command before the Mac shutdown command: > > ??upscmd -u upsmaster -s sekret UPS at synology shutdown.stayoff > > but you would need to be sure that the UPS shutdown delay is long enough to allow the NAS to go into safe mode. (This is why it is > recommended that the master (the NAS in your case) initiate the UPS shutdown.) Also, you would need to configure that NUT user to allow > instant commands in upsd.users as well as upsrw access. > > I have SHUTDOWNCMD "/sbin/shutdown -h +0? now on the Mac is was SHUTDOWNCMD ?? before.> How do I check if the UPS is turning itself off after the NAS goes into safe mode??On most UPS units, there is a light which goes out. Some produce an audible clunk as the relays disconnect the UPS power outlets. You could also connect a light bulb to a protected outlet. It should go out when the UPS shuts down. Example test: 1. Pull power cord from wall 2. UPS beeps, NAS and Mac continue operation 3. Users are warned that power has failed 4. When the battery drops to battery.charge.low the slave (Mac) and then the master (NAS) shutdown. 5. After 20 seconds the UPS shuts down. 6. Reconnect the wall power 7. NAS and Mac should restart You will also need a test in which you wait a long time before step 6, and a test in which you reconnect power between steps 4 and 5. Roger
> When you carry out tests to ensure that the setup is working well, you will pull the power cord from the wall and wait until the UPS reaches LB. This means waiting and wasting time. You can speed up the testing by setting LB very high so that the UPS reaches it quickly. Later you can set a more reasonable value.After the first test and the NAS is restarted I had to change the setting battery.charge.low again to 80> On most UPS units, there is a light which goes out. Some produce an audible clunk as the relays disconnect the UPS power outlets. You could also connect a light bulb to a protected outlet. It should go out when the UPS shuts down.The APC produced an audible clunk. So the UPS was shutdown. I am not sure it was after 20 seconds. I have to clock that.> Example test: > > 1. Pull power cord from wall > > 2. UPS beeps, NAS and Mac continue operation > > 3. Users are warned that power has failed > > 4. When the battery drops to battery.charge.low the slave (Mac) and then the master (NAS) shutdown. > > 5. After 20 seconds the UPS shuts down. > > 6. Reconnect the wall power > > 7. NAS and Mac should restartResult test 1 1. Pull power cord from wall. ? OK 2. UPS beeps, NAS and Mac continue operation 3. Users from the NAS are warned, not yet the Mac user. Only when executing automatic power-fail shutdown. 4. Yes, Both the Mac and NAS shutdown. Only the Mac shutdown so fast that it looks like pressing the off button. The NAS I have to check if it was in safe-mode some how. 5. The UPS shuts down. I heard an audible clunk. 6. Reconnect the wall power ? OK 7. No they didn?t restart. I know there is a setting on the NAS to activate this. I will check and try again. This is what is reported from the terminal on the Mac: ----- Broadcast Message from <user>@<computer name> (/dev/ttys001) at 21:30 CEST... Executing automatic power-fail shutdown ??? and ??? sudo upsmon -D Network UPS Tools upsmon 2.7.4 kill: No such process 0.000000 UPS: ups@<ip address> (slave) (power value 1) 0.000718 Using power down flag file /etc/killpower 0.001192 debug level is '1' 0.008274 Trying to connect to UPS [ups@<ip adddress>] 0.009866 Logged into UPS ups@<ip adddress> 290.089253 Critical UPS: ups@<ip adddress> 290.089313 Shutting down any UPSes in MASTER mode... 290.089322 Executing automatic power-fail shutdown Broadcast Message from <user>@<computer name> (/dev/ttys001) at 21:30 CEST... Executing automatic power-fail shutdown Kind regards, Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20170608/e4d1a86c/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3583 bytes Desc: not available URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20170608/e4d1a86c/attachment.bin>
On Jun 8, 2017, at 4:06 PM, Robbie van der Walle <rvanderwalle at gmail.com> wrote:> > 7. No they didn?t restart. I know there is a setting on the NAS to activate this. I will check and try again.Not sure for the NAS, but for the Mac, it is probably something like this: sudo pmset -a autorestart 1 There is also usually a checkbox in the Energy Saver panel in the System Preferences GUI.
On Thu, 8 Jun 2017, Robbie van der Walle wrote:> After the first test and the NAS is restarted I had to change the > setting battery.charge.low again to 80?Does the NAS DSM reset battery.charge.low to 10 or is it internal to the UPS? You will have to experiment by disconnecting the UPS control lead from the NAS and connecting it (if possible) to the Mac. After setting to 80 and a power off-on cycle is the value 80 or 10?> 3. Users from the NAS are warned, not yet the Mac user.? Only when > executing automatic power-fail shutdown.?In upsmon.conf on the Mac, what are the values of NOTIFYMSG ONBATT and NOTIFYFLAG ONBATT? Does program wall work on the Mac? It fails on a lot of Linux boxes with graphical interfaces - to get a message to the user, you have to use notify-send, which means setting up upssched.> 7. No they didn?t restart. I know there is a setting on the NAS to > activate this. I will check and try again.?Does the NAS have a BIOS option "Power on when AC resumes"? Roger
On Fri, 9 Jun 2017, Robbie van der Walle wrote:> # NOTIFYMSG - change messages sent by upsmon when certain events occur > # > # You can change the default messages to something else if you like. > # > # NOTIFYMSG <notify type> "message" > # > # NOTIFYMSG ONLINE "UPS %s on line power" > # NOTIFYMSG ONBATT "UPS %s on battery" > # NOTIFYMSG LOWBATT "UPS %s battery is low" > # NOTIFYMSG FSD "UPS %s: forced shutdown in progress" > # NOTIFYMSG COMMOK "Communications with UPS %s established" > # NOTIFYMSG COMMBAD "Communications with UPS %s lost" > # NOTIFYMSG SHUTDOWN "Auto logout and shutdown proceeding" > # NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced" > # NOTIFYMSG NOCOMM "UPS %s is unavailable" > # NOTIFYMSG NOPARENT "upsmon parent process died - shutdown impossible" > #Lots more lines of comments. Please remove comments and blank lines before posting in mailing lists. I gave up reading. Roger
>> After the first test and the NAS is restarted I had to change the setting battery.charge.low again to 80 > > Does the NAS DSM reset battery.charge.low to 10 or is it internal to the UPS? You will have to experiment by disconnecting the UPS control lead from the NAS and connecting it (if possible) to the Mac. After setting to 80 and a power off-on cycle is the value 80 or 10?Ok I will have try this. I am also searching on the NAS if it set somehow.>> 3. Users from the NAS are warned, not yet the Mac user. Only when executing automatic power-fail shutdown. > > In upsmon.conf on the Mac, what are the values of NOTIFYMSG ONBATT and NOTIFYFLAG ONBATT? Does program wall work on the Mac? It fails on a lot of Linux boxes with graphical interfaces - to get a message to the user, you have to use notify-send, which means setting up upssched.#NOTIFYMSG ONBAT NOTIFYFLAG ONBATT EXEC> Does program wall work on the Mac?file testwall: hallo tried: wall testwall and result: Broadcast Message from (/dev/ttys002) at 11:28 CEST... hallo So wall work in a terminal only.> It fails on a lot of Linux boxes with graphical interfaces - to get a message to the user, you have to use notify-send, which means setting up upssched.# NOTIFYCMD <command> NOTIFYCMD /sw/sbin/upssched Results second test 1 after changing on NAS, Control Panel Hardware & Power, Power recovery, Restart automatically after a power failure. And changing on the Mac, system preferences, energy saver, start up automatically after a power failure. 1 Pull power cord 2 Ups beeps NAS and Mac work 3 NAS users warned. Mac not 4 low bat, first slave Mac shutdown. Than Master NAS shutdown. ( report in log NAS, server is on battery, server going to safe shutdown) 5 UPS shutdown after 29 seconds. 6 reconnect power 7 NAS now starts up but Mac doesn?t Kind Regards, Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20170609/f02003a0/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3583 bytes Desc: not available URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20170609/f02003a0/attachment.bin>