[Nut-upsuser] Are all measurements are in seconds?

Charles Lepple clepple at gmail.com
Sat Mar 16 18:18:15 GMT 2024


On Mar 14, 2024, at 11:09 AM, Alan via Nut-upsuser <nut-upsuser at alioth-lists.debian.net> wrote:
> 
> Hi,
> 
> I am studying (in a few months I might go on a TV quiz show :-)
> Rodger's excelent guide and wanted to confirm that all measurements in
> NUT are in seconds.

all timing measurements are in seconds, yes.

> For example, the Cyber Power System CP1500 AVR UPS returns that the
> **driver.parameter.pollfreq = 30**. This means that I can (maybe
> should) adjust the settings within NUT.CONF to match this value.
> Setting this value to 2 seconds gains will return the same value 14
> times.
> 
> Is my reasoning correct?

I'm not sure I follow - which settings do you want to adjust, and why? Do you mean driver polling intervals in ups.conf, or upsmon.conf (POLLFREQ*)?

The pollfreq value (the time between full updates of all HID reports, in usbhid-ups) defaults to 30 seconds to not bog down the UPS. Less-critical values (ups.load, input.frequency, etc.) may not update as often this way. However, the OB/LB flags are part of the set that is polled and/or checked via USB "interrupt" transfers every pollinterval seconds (default: 2).

You can see the full/quick difference by stopping NUT, then manually starting the driver with at least one "-D" flag. Or reference the driver source for your UPS to see the possible set of values that the driver will check for. For Cyber Power, that table starts at https://github.com/networkupstools/nut/blob/master/drivers/cps-hid.c#L187 and the ones with HU_FLAG_QUICK_POLL will be updated per pollinterval.

While this throttling may seem unnecessary, note that many UPS microcontrollers use USB 1.x low-speed transfers (1.5 Mbit/sec bit raw rate, but throughput can be 10x less) and there is a fair amount of back-and-forth to poll USB HID values that aren't sent automatically whenever the USB interrupt pipe is polled.

That said, if you are observing the same value 14x in a row, then changing and holding for another 14x-15x, it is certainly possible that the UPS is not updating its values as frequently as the driver polls.

-- 
Charles Lepple
clepple at gmail




More information about the Nut-upsuser mailing list