[Nut-upsuser] Ex post facto logging

Sam Varshavchik
Sat, 04 Oct 2025 19:46:00 -0000

Greg Troxel writes:

> Sam Varshavchik <mrsam at courier-mta.com> writes:
>
> > I lost power for about 40 seconds. From what I can see NUT quickly
> > shut down the system and boot it back up when power was restored. That
> > also worked. Everything worked as designed, except I would expect such
> > a brief shutdown to be survivable.
>
> It's really odd to lose power for 40 seconds in my experience.  I
wonder
> roughly where you are (looks like NA due to 120V, state?) and if you
> understand the mechanism for how it came back so fast.

Yes, New Jersey. I'm fairly certain that it was local maintenance. The power
grid here is pretty robust and redundant. This was early Saturday morning,
I'm pretty sure it's weekend maintenance, they cut off a portion of a
grid,
and then quickly cut it in somewhere else.

> I would look in the logs and see if you can find that nut logged
> something about "low battery" or "forced shutdown".

Well, that's what I'm asking. Where do I find these logs. I poked around
with journalctl, and found just startup and shutdown messages.

>                                                     It is possible your
> batteries are tired, and it's possible that things are not configured
> right.

I'm fairly certain this is the case and I'll swap them. I was only
wondering
where the logs are, of nut doing its thing, I couldn't see anything in
journalctl aside from routine startup messages.

> I use a script running upsc and reporting via mqtt logging in home
> assistant, and thus have data for outages.  But 40s is crazy.
>
> > battery.charge: 29
> > battery.charge.low: 10
> > battery.charge.warning: 20
>
> 10 for low seems a bit low but not crazy.  29 is super low for having
> experience a 40s outage.  I would see where it is after 48h.

It's now:

battery.charge: 100

I didn't monitor it closely enough to know when it finished charging.

The 40s is my best estimate based on my security alarm's messages to my
phone. It's an independent system with its own built-in backup, and it barks
at my phone when it loses and regains power.

As far as the low/warning levels these are apparently the defaults. I did
not override anything in ups.conf:

[nutdev1]
        driver = "usbhid-ups"
        port   = "auto"
        pollinterval = 10

That's it, that's all I've got.

> > battery.mfr.date: CPS
> > battery.runtime: 2939
> > battery.runtime.low: 300
>
> 2939s is a very good runtime, and 300s is a reasoable "when runtime is
> below this value, start shutdown".

I surmise that battery.runtime is calculated. This looks to me like it might
be based on a healthy battery's capacity, but when push comes to shove, the
UPS sees how fast the voltage is really dropping, and ?oh crap?
ter.
>
> > driver.name: usbhid-ups
> > driver.parameter.pollfreq: 30
> > driver.parameter.pollinterval: 10
> > driver.parameter.port: auto
> > driver.parameter.synchronous: auto
>
> I'm unclear on these.  Did you get a log entry when power failed?

I dunno, that's what I'm asking. I don't see anything useful logged
anywhere
I looked. I found three things in systemctl, nut-monitor, nut-server, and a
"nut-driver at nutdev1", and journalctl didn't show anything
useful for these.
Oh, they had something, but it was just the stock startup messages. Nothing
was actually logged, for power events.

> > driver.state: quiet
> > driver.version: 2.8.1
>
> That's old.  Update to the latest release.  I know you're using
Ubuntu
> and they are behind.  Update anyway.

I'm almost there, as far as motivation goes, to do that. Off-topic: I have
the same Ubuntu/Debian general complaint: for the longest time Debian
packaged ancient versions of my packages. Like decades ancient. I should say
now that a volunteer has stepped out and is making progress; but I
eventually solved that problem by figuring out how to package my tarballs so
that they can be cookie-cuttered into installable .deb-s, similar to how rpm-
aware tarballs can be compiled into binary packages without even extracting
them.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL:
<http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20251004/147189a7/attachment.sig>