Jim Klimov via Nut-upsdev <[email protected]> writes:

> Regarding the failure criteria, probably there is no "size that suits all":
> one complication is that some drivers actively poll devices with some
> frequency for all data, others with different frequencies (full/quick walks
> mentioned earlier), yet others get interrupts or other data pushes
> initiated by the device. Now we are getting more drivers that de-facto talk
> several protocols (e.g. devices have different data channels over USB) and
> get different data views over each "link".

It's true that it's all complicated.

> Either way, polling with some frequency means that frequency was hard-coded
> or more likely configured on the driver side. I don't think there is any
> configuration for expected interrupts frequency => unhealthy data age.


There may not be, but the upsd/driver interface is an abstraction
boundary, and the driver author is in the best position to know "is the
data I'm reporting ok, or isn't it".

> The driver reports to its local `upsd` relatively instantly (usually after
> it ends the data walk) which caches its copy of the data, and reports that
> copy to clients like `upsc`.  So the age is practically always > 0. What
> the unhealthy value is, that's questionable - probably MAXAGE as for data
> stale assigned by `upsd` to a stuck driver altogether (which is separate
> from drivers being alive and reporting that data is stale because they know
> vendor protocol dialog failed). At least, `MAXAGE` is a setting in
> `upsd.conf` so the data server knows the value to compare data point  ages
> (`st_tree_t.lastset`) against.

I would prefer the simplest reasonable plan that solves 99% of concerns.

I get it that you would like per-item timestamps, and I would suggest
that time-of-observation metadata is a reasonable thing to do, but
separate from "stale or ok".

Yes, the age of the values obtainable by upsc will always be > 0, and
it's too tricky to track precisely.   I think that what almost all
readers want is to know "valid recent values" vs "we're not getting
updates as we should and these values are old".   That's why I suggested
age be 0 if the driver thinks it is in "healthy mode", and then count up
from the time it last thought it healthy.

Arugably, if the driver crashes, upsd should increase age.  So: when the
driver writes full data, it includes some timeval associated with the
read cycle (start or end, whatever), and then when answering upsd
computes age=now-last_written.  Thus age will start off very low, and start
to go up if either the driver doesn't write a new timeval, or if the
driver is not heard from.  That's really easy for the reader to deal
with.  The python code I'm using to report could say "if age > 10s,
pretend the read failed".  It's up to the specific reader to decide
what's too old, and I don't think it needs to be configured in NUT.


As for drivers that get messages from the UPS, those driver writers need
to understand the plan of how often that should be and program in a
timer.  If the UPS is supposed to write every 30s, then after 35s it's
stale, unless the transmission isn't reliable.  A driver writer could
poll at 31s, if they wanted to, but I'd hope things basically work and
that kind of coding is unnecessary.


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

Reply via email to