Well it is the season for storms and power outages here in the US PNW. I noticed that today when the power went out, NUT mostly did what I hoped/wanted. But it did not actually turn off the UPS at all. The UPS kept beeping and I had to turn it off manually. I thought that NUT would handle this. But perhaps it cannot for my unit? Or perhaps I have things improperly configured? Any suggestions? Thanks and happy new year! I have attached the nut.report and the following is the output of the "upsc belkinusb" command: battery.voltage.nominal: 12.0 device.type: ups driver.name: blazer_usb driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.version: 2.7.1 driver.version.internal: 0.10 input.current.nominal: 3.0 input.frequency: 60.1 input.frequency.nominal: 60 input.voltage: 124.9 input.voltage.fault: 124.9 input.voltage.nominal: 120 output.voltage: 124.9 ups.beeper.status: enabled ups.delay.shutdown: 30 ups.delay.start: 180 ups.load: 0 ups.productid: 5161 ups.status: OL ups.type: offline / line interactive ups.vendorid: 0665 android at localhost:/etc/nut$ ^C android at localhost:/etc/nut$ cls -bash: cls: command not found android at localhost:/etc/nut$ clear android at localhost:/etc/nut$ upsc belkinusb Init SSL without certificate database battery.charge: 100 battery.voltage: 13.60 battery.voltage.high: 13.00 battery.voltage.low: 10.40 battery.voltage.nominal: 12.0 device.type: ups driver.name: blazer_usb driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.version: 2.7.1 driver.version.internal: 0.10 input.current.nominal: 3.0 input.frequency: 60.1 input.frequency.nominal: 60 input.voltage: 125.7 input.voltage.fault: 125.5 input.voltage.nominal: 120 output.voltage: 125.7 ups.beeper.status: enabled ups.delay.shutdown: 30 ups.delay.start: 180 ups.load: 0 ups.productid: 5161 ups.status: OL ups.type: offline / line interactive ups.vendorid: 0665 android at localhost:/etc/nut$ -------------- next part -------------- NUT configuration 2020-01-01 02:30:54 UTC ########### Operating system ########### 3.0.36+ GNU/Linux NAME="Ubuntu" PRETTY_NAME="Ubuntu 14.04 LTS" ########### /etc/nut/nut.conf ########### MODE=standalone ########### /etc/nut/ups.conf ########### maxretry = 3 [belkinusb] driver = blazer_usb port = auto desc = "Belkin UPS, USB interface" ########### /etc/nut/upsd.conf ########### MAXAGE 15 LISTEN 127.0.0.1 3493 MAXCONN 1024 ########### /etc/nut/upsd.users ########### [local_mon] password = ********* upsmon master ########### /etc/nut/upsmon.conf ########### MONITOR belkinusb at localhost 1 local_mon ********* master MINSUPPLIES 1 SHUTDOWNCMD "/sbin/shutdown -h +0" NOTIFYCMD /home/android/nutShutdown.sh POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 15 DEADTIME 15 POWERDOWNFLAG /etc/killpower NOTIFYMSG ONBATT "UPS %s on battery" NOTIFYFLAG ONBATT WALL+EXEC RBWARNTIME 43200 NOCOMMWARNTIME 300 FINALDELAY 5 ########### /etc/nut/upssched.conf ########### CMDSCRIPT /bin/upssched-cmd ########### <scriptname> ########### Cannot access <scriptname> ########### /etc/hosts.allow ########### ########### ps aux ########### nut 2333 0.0 0.0 3336 696 ? Ss 13:32 0:07 /sbin/upsd root 2355 0.0 0.0 3328 824 ? Ss 13:32 0:00 /sbin/upsmon nut 2364 0.0 0.2 4280 1812 ? S 13:32 0:03 /sbin/upsmon ########### Ownership and permissions of executables ########### -rwxr-xr-x 1 root root 43204 Dec 30 2013 /sbin/upsd* -rwxr-xr-x 1 root root 18224 Dec 30 2013 /sbin/upsdrvctl* -rwxr-xr-x 1 root root 30852 Dec 30 2013 /sbin/upsmon* -rwxr-xr-x 1 root root 22340 Dec 30 2013 /sbin/upssched* -rwxr-xr-x 1 root root 100064 Apr 11 2014 /sbin/upstart-dbus-bridge* -rwxr-xr-x 1 root root 95824 Apr 11 2014 /sbin/upstart-event-bridge* -rwxr-xr-x 1 root root 108140 Apr 11 2014 /sbin/upstart-file-bridge* -rwxr-xr-x 1 root root 104100 Apr 11 2014 /sbin/upstart-local-bridge* -rwxr-xr-x 1 root root 99924 Apr 11 2014 /sbin/upstart-socket-bridge* -rwxr-xr-x 1 root root 58980 Apr 11 2014 /sbin/upstart-udev-bridge* ########### Ownership and permissions of configuration files ########### -rwxrwxrwx 1 root nut 1544 Jul 7 13:12 /etc/nut/nut.conf* -rwxrwxrwx 1 root nut 4653 Jul 9 09:06 /etc/nut/ups.conf* -rwxrwxrwx 1 root nut 4572 Jul 7 13:16 /etc/nut/upsd.conf* -rwxrwxrwx 1 root nut 2177 Jul 7 13:17 /etc/nut/upsd.users* -rwxrwxrwx 1 root nut 15271 Jul 18 15:55 /etc/nut/upsmon.conf* -rwxrwxrwx 1 root nut 3887 Dec 30 2013 /etc/nut/upssched.conf* ########### nut-journal ###########
On Tue, 31 Dec 2019, David White wrote:> ... But it did not actually turn off the UPS at all. The UPS kept > beeping and I had to turn it off manually. > > I thought that NUT would handle this. But perhaps it cannot for my unit? Or > perhaps I have things improperly configured? Any suggestions? Thanks and > happy new year!> ########### /etc/nut/upsmon.conf ########### > MONITOR belkinusb at localhost 1 local_mon ********* master > MINSUPPLIES 1 > SHUTDOWNCMD "/sbin/shutdown -h +0" > NOTIFYCMD /home/android/nutShutdown.sh > POLLFREQ 5 > POLLFREQALERT 5 > HOSTSYNC 15 > DEADTIME 15 > POWERDOWNFLAG /etc/killpower > NOTIFYMSG ONBATT "UPS %s on battery" > NOTIFYFLAG ONBATT WALL+EXEC > RBWARNTIME 43200 > NOCOMMWARNTIME 300 > FINALDELAY 5> ########### /etc/nut/upssched.conf ########### > CMDSCRIPT /bin/upssched-cmdHappy New Year David!, The command "/sbin/upsdrvctl shutdown" turns off the UPS unit, but this is not being executed. How do you plan to shut down on power failure? Will you wait for upsd's [LB] status or use a timer? The simplest is to wait for [LB], but the upsmon.conf contains no declarations for NOTIFYFLAG LOWBATT. The script /home/android/nutShutdown.sh will be called when wall power fails, but nut-report was unable to show its contents. Should nutShutdown.sh perform the system shutdown? Perhaps a more complete set of NOTIFYFLAG and NOTIFYMSG declarations will make things clearer. I would also recommend adding the SYSLOG option to the declarations. Do you shutdown using systemd? Roger
On 1/1/2020 2:21 AM, Roger Price wrote:> On Tue, 31 Dec 2019, David White wrote: > >> ... But it did not actually turn off the UPS at all. The UPS kept >> beeping and I had to turn it off manually. >> >> I thought that NUT would handle this. But perhaps it cannot for my >> unit? Or perhaps I have things improperly configured? Any suggestions? >> Thanks and happy new year! > >> ########### /etc/nut/upsmon.conf ########### >> MONITOR belkinusb at localhost 1 local_mon ********* master >> MINSUPPLIES 1 >> SHUTDOWNCMD "/sbin/shutdown -h +0" >> NOTIFYCMD /home/android/nutShutdown.sh >> POLLFREQ 5 >> POLLFREQALERT 5 >> HOSTSYNC 15 >> DEADTIME 15 >> POWERDOWNFLAG /etc/killpower >> NOTIFYMSG ONBATT "UPS %s on battery" >> NOTIFYFLAG ONBATT WALL+EXEC >> RBWARNTIME 43200 >> NOCOMMWARNTIME 300 >> FINALDELAY 5 > >> ########### /etc/nut/upssched.conf ########### >> CMDSCRIPT /bin/upssched-cmd > > Happy New Year David!, The command "/sbin/upsdrvctl shutdown" turns off > the UPS unit, but this is not being executed. How do you plan to shut > down on power failure? Will you wait for upsd's [LB] status or use a > timer? The simplest is to wait for [LB], but the upsmon.conf contains > no declarations for NOTIFYFLAG LOWBATT. > > The script /home/android/nutShutdown.sh will be called when wall power > fails, but nut-report was unable to show its contents. Should > nutShutdown.sh perform the system shutdown? > > Perhaps a more complete set of NOTIFYFLAG and NOTIFYMSG declarations > will make things clearer. I would also recommend adding the SYSLOG > option to the declarations. > > Do you shutdown using systemd? > > Roger >Hi Roger and, as always, thanks! I really do not want to wait very long before shutting down things on this UPS. What I think I am doing (or at least trying to do) is to execute a script on the host machine when the UPS is detected by NUT to be on battery power. That script sleeps 20 seconds to ensure that this was not just a power blip (which happens here often) but a real power outage. After 20 seconds, the script checks the UPS status via upsc and if it is no longer OB, power is deemed restored and the script exits. If, after 20 seconds, UPS status remains OB then the event is deemed a true power outage and I want to shut down what I can cleanly. To do this, the script issues remote shutdown commands to a set of network connected devices also living on this UPS (but sadly not able to run NUT). As its final step, it issues a command to shut the host machine down. It seems from what you say above, I need to issue "/sbin/upsdrvctl shutdown" in there somewhere - obviously before I shut the host machine down. I will have to test this to see exactly what that command does. When run w/out arguments, the usage says shutdown shuts down UPS drivers. I am not clear if this means that the UPS itself will be powered off or if simply NUT is shutdown. Thanks