Description of the problem
I have UPS Orvaldi KC2000 (its capacity: 2000VA/1400W) and I want to setup configuration of my Debian 10 (Buster which is currently testing) to:
- get GUI (preferably GNOME) notifications when there is power failure and my computer is running on UPS battery (to know that I have little time to save the work and turn off the system),
- automatically turn off the computer when the battery of my UPS is critically low.
I hoped that this is easy with NUT (Network UPS Tools), but it turned out that there is no obvious way to meet the 1-st requirement – which is getting GUI (preferably GNOME) notifications.
What I've done to solve the problem?
I've installed NUT (provided by nut package which installs [among others] nut-server and nut-client) and I configured it by editing files residing in /etc/nut directory.
root@host:~# ls /etc/nut
nut.conf ups.conf upsd.conf upsd.users upsmon.conf upssched.conf
specifically:
/etc/nut/upsd.users:[upsmon] # name of my UPS password = my_UPS_password actions = SET instcmds = ALL upsmon master/etc/nut/nut.conf:MODE=standalone/etc/nut/ups.conf:maxretry = 3 [myups] driver = blazer_usb port = auto/etc/nut/upsmon.conf:MONITOR myups@localhost 1 upsmon my_UPS_password master MINSUPPLIES 1 SHUTDOWNCMD "/sbin/shutdown -h +0" POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 15 DEADTIME 15 POWERDOWNFLAG /etc/killpower RBWARNTIME 43200 NOCOMMWARNTIME 300 FINALDELAY 5rest of the files (
/etc/nut/upsd.conf,/etc/nut/upssched.conf) have default content –/etc/nut/upsd.confis empty and/etc/nut/upssched.confhas single line:CMDSCRIPT /bin/upssched-cmd.
(I skipped the comments sections in the above listings.)
After editing above configuration files I needed to run systemctl restart nut-*. * may be overkill, but I don't remember which services need to be restarted – nut-client.service, nut-driver.service, nut-monitor.service or nut-server.service.
I also installed nut-monitor which (quote): provides nut-monitor, a GUI application to monitor UPS status. I hoped that nut-monitor has some functionality that allows to popup warning window if UPS battery is low or there is some way to configure GNOME to display status of the UPS, but unfortunately I didn't find any way to do that.
To simulate power failure I use 2 commands: upsdrvctl -t shutdown and upsmon -c fsd (which shuts down the computer).
Recently I've found that there is nut-hal-drivers package that provides GUI notifications, but:
- I can't find this package in Debian repository.
nut-hal-driverspackage apparently doesn't work withupsmonandupsdprovided by thenutpackage.
The question
My question: how can I setup configuration of my system to popup some kind of warning (preferably popup message native for given desktop environment) if there is power failure and my computer is using UPS' battery?