[Nut-upsuser] UPS heartbeat on battery
Jim Klimov
jimklimov+nut at gmail.com
Mon Mar 31 13:40:43 BST 2025
Thinking of it, there was a change to handling of files by dummy-ups around
2.8.0 release: depending on an explicit setting or a file extension:
> Specify mode instead of guessing it from port value (dummy = dummy-loop,
dummy-once, repeater) : -x mode=<value>
As the man page goes, by default "*.dev"=>"dummy-once" (emulate a device
snapshot, so once to the end of file and stop) and "*.seq"=>"dummy-loop"
(run a device behavior sequence, so looping).
Jim
On Mon, Mar 31, 2025 at 2:06 PM Dan Langille via Nut-upsuser <
nut-upsuser at alioth-lists.debian.net> wrote:
> On Sat, Mar 29, 2025, at 5:24 PM, Dan Langille via Nut-upsuser wrote:
>
>
>
> On Sat, Mar 29, 2025, at 4:40 PM, Jim Klimov wrote:
>
> The problem with computers - they do what you tell them to, not what you
> might want them to.
>
>
> I've never liked them. Terrible things. It's merely a fad.
>
> Here your heartbeat.dev literally tells the emulation driver to set
> ups.status=OL, wait 300s, set it to OB, wait 300s, repeat.
>
> So NUT reporting that the heartbeat UPS became on-battery 5 minutes after
> start means these pieces are doing their job correctly and talking to each
> other well.
>
> Jim
>
>
> Outside eyes are so useful.
>
> I knew what you meant as soon as I read the second paragraph.
>
>
> After going through the original post (
> https://alioth-lists.debian.net/pipermail/nut-upsuser/2017-April/010590.htm)
> again, I now understand how it's trying to achieve the goal.
>
> I also managed to fix several other issues with my configuration. NOTE to
> readers: don't use my postedconfiguration it was wrong. For example, most
> of my NOTIFYCMD should have been NOTIFYFLAG (I suspect copy/paste failures).
>
> I also corrected upsd.users and upsmon.conf which had conflicting users.
>
> I later discovered that heartbeat.dev must now be heartbeat.conf - the
> former partially works. Details below.
>
> Here is an example of restarting nut while nut_upsmon is running. Seems
> sensible to me.
>
> Mar 30 20:05:58 gw01 upsd[73103]: mainloop: Interrupted system call
> Mar 30 20:06:00 gw01 upsmon[76592]: Poll UPS [ups04] failed - Server
> disconnected
> Mar 30 20:06:00 gw01 upsmon[76592]: Communications with UPS ups04 lost
> Mar 30 20:06:00 gw01 upsmon[76592]: Poll UPS [heartbeat] failed - Write
> error: Broken pipe
> Mar 30 20:06:00 gw01 upsmon[76592]: Communications with UPS heartbeat lost
> Mar 30 20:06:05 gw01 upsmon[76592]: UPS [ups04]: connect failed:
> Connection failure: Connection refused
> Mar 30 20:06:05 gw01 upsmon[76592]: UPS [heartbeat]: connect failed:
> Connection failure: Connection refused
> Mar 30 20:06:10 gw01 upsmon[76592]: UPS [ups04]: connect failed:
> Connection failure: Connection refused
> Mar 30 20:06:10 gw01 upsmon[76592]: UPS [heartbeat]: connect failed:
> Connection failure: Connection refused
> Mar 30 20:06:15 gw01 upsmon[76592]: Communications with UPS ups04
> established
> Mar 30 20:06:15 gw01 upsmon[76592]: Communications with UPS heartbeat
> established
> Mar 30 20:11:05 gw01 upsmon[76592]: UPS heartbeat on battery
>
> However, I never see a switch back to line power. I've waited about 35
> minutes now.
>
> Reading further, I rediscovered:
> https://rogerprice.org/NUT/ConfigExamples.A5.pdf
>
> In there, I found: 2020-08-20 File heartbeat.dev becomes heartbeat.conf
>
> I renamed all instances of heartbeat.dev to heartbeat.conf, and
> restarted both nut & upsmon.
>
> Boom. Actual results matched expected results:
>
> Mar 30 20:54:22 gw01 upsmon[76592]: UPS heartbeat on battery
> Mar 30 20:59:23 gw01 upsmon[76592]: UPS heartbeat on line power
> Mar 30 21:04:24 gw01 upsmon[76592]: UPS heartbeat on battery
> Mar 30 21:09:29 gw01 upsmon[76592]: UPS heartbeat on line power
> Mar 30 21:14:30 gw01 upsmon[76592]: UPS heartbeat on battery
> Mar 30 21:19:30 gw01 upsmon[76592]: UPS heartbeat on line power
> Mar 30 21:24:31 gw01 upsmon[76592]: UPS heartbeat on battery
> Mar 30 21:29:37 gw01 upsmon[76592]: UPS heartbeat on line power
> Mar 30 21:34:37 gw01 upsmon[76592]: UPS heartbeat on battery
>
> To verify it was the device name, I stopped both daemons and made the
> following modifications:
>
> * ups.conf: 'port = heartbeat.conf' -> 'port = heartbeat.dev'
> * mv heartbeat.conf heartbeat.conf
>
> Start nut, start ups_mon.
>
> With that configuration, the previously mentioned behavior returned.
>
> Reverting the changes resulted in the expected swapping between battery
> and line every 5 minutes.
>
> Thank you for getting me started on the right track.
>
> --
> Dan Langille
> dan at langille.org
>
>
> _______________________________________________
> Nut-upsuser mailing list
> Nut-upsuser at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20250331/dc767406/attachment-0001.htm>
More information about the Nut-upsuser
mailing list