[Nut-upsuser] UPS heartbeat on battery
Dan Langille
dan at langille.org
Mon Mar 31 12:48:05 BST 2025
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20250331/08393c16/attachment.htm>
More information about the Nut-upsuser
mailing list