[Nut-upsuser] finding a common abstraction for reporting

Charles Lepple clepple at gmail.com
Mon Mar 21 03:01:12 GMT 2022


On Mar 17, 2022, at 7:26 PM, Greg Troxel <gdt at lexort.com> wrote:
> 
> My script is in the process of being extended to also deal with apcupsd
> and that seems to have different variables, like timeleft in minutes
> instead of runtime in seconds.  It seems obvious to me that I should
> bring things into a common schema, because the monitoring system doesn't
> care about UPS brand; it wants to know is utility power good enough, how
> many seconds left, etc.

I am not necessarily recommending that you should use apcupsd-ups (it's monitor-only and won't send the shutdown command[*], for one thing); however, it's worth pointing out that a few of the conversion factors are documented in that driver's source:

https://github.com/networkupstools/nut/blob/v2.7.4/drivers/apcupsd-ups.h#L66

[*] https://networkupstools.org/docs/man/apcupsd-ups.html#_limitations

> I wonder how much NUT does that by itself, or if it's more doing format
> translation of the individual units.  And I would appreciate comments on
> the wisdom/necessity of this approach.

What Jim said about this is technically correct, but I would look at it another way:

NUT defines standard units for variables (as long as the variables are not marked as "opaque"), and the drivers map device-specific readings to those standard units. (USB HID PDC tends to use seconds, as do most SNMP MIBs, if I am not mistaken.)

Units are in parentheses in the Description column: https://networkupstools.org/docs/user-manual.chunked/apcs02.html

-- 
Charles Lepple
clepple at gmail




More information about the Nut-upsuser mailing list