Edgar Fuß via Nut-upsdev <[email protected]> writes:

> Isn't the most interesting information not how old some data is, but how long 
> it's overdue (taking into account the peculiarities of this specific 
> hardware)?

Agreed.  There are multiple ways for measurements to flow from the UPS
unit to upsd, and as a user of upsd (via upsc or the protocol) I would
like not to care about those details.

> OTOH, my feeling is that most of this how-long-is-that-data-stale
> logic belongs into upsd, not into each individual driver. (And
> deciding whether a certain data being stale for a certain time is a
> problem belongs into the application: I can live with not knowing when
> it will be time to replace the battery for much longer than with not
> knowing whether I'm on battery.)

To me the key point is that when a driver makes a report, that report
should only include information which is "not stale", with some
acceptable fuzz for values that are read less frequently.  And then upsd
should convey "how long since the last (non-stale) report".  I see this
as pretty straightforward conceptually.

> So, what about the driver, at initialization time, telling upsd, for each 
> value, what the expected update interval is (with upsd chosing a default for 
> the majority of them) and having upsd deal with the rest?
> Of course, there should be an additional method for the driver to tell upsd 
> that reading a value failed by providing an "undefined" value.

I always lean to the simplest reasonable approach.  Here,

  I would like drivers to be able to report "unavailable" for a value,
  and drivers should manage timeouts (that they understand because it's
  device behavior) and report them as unavailable.

  If the driver stops communicating, upsd should set everything to
  unavailable.  Timeout here could be 5s by spec, and drivers that are
  up and functioning and have no news can just keepalive to avoid this
  timeout.   This would matter only for a driver crash.

which is mostly what you said, but not pushing timeouts to upsd.


Separately, I would suggest that with a driver reading from a UPS unit,
things are either

  ok, where all  values can be read routinely

  not ok, where some values that should work give errors

and we should not agonize over shades of grey of not ok, and let drivers
decide which side of the boundary they are on.  To me the things that
really matter and the timescales I care about them are

  input voltage - ok or bad: immediate
  online or on battery: a few seconds
  battery voltage or remaining runtime: 30s

  output VA: nice to have a few seconds, every minute is acceptable

  battery needs replacement: 1h
  

_______________________________________________
Nut-upsdev mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev

Reply via email to