[Nut-upsuser] upsd "events"

Roger Price roger at rogerprice.org
Sat Nov 7 20:29:12 GMT 2020

On Sat, 7 Nov 2020, Jason Antman wrote:

> * One CyberPower UPS powering everything
> * Three Linux machines, "A", "B", and "C"
> * A bunch of network devices, as well as two Raspberry Pis
> I'm trying to achieve the following shutdown behavior:
> * Kill host A when battery drops to 80%
> * Kill host B at 50%
> * Kill host C at 10%
> * Leave the outputs turned on always, so the network and Pis keep running
> * If the power comes back before the battery is exhausted, a script will turn on hosts A, B, and C via wake-on-lan.

> I found the "nut2" Python package (https://github.com/rshipp/python-nut2) 
> which is built on top of python's telnetlib. That should make most of the 
> logic rather simple, certainly as compared to the C implementation. It 
> shouldn't be too difficult to handle that reliably.

It should be even simpler to use upsmon as a passthrough to upssched + a Bash 
script often called upssched-cmd.  Working in Python is very interesting, but a 
custom upssched.conf and Bash script for A, B and C should be quite sufficient 
for your setup.


More information about the Nut-upsuser mailing list