Skip to content

NUTCase and APC's apcupsd

Arthur Mitchell edited this page Mar 7, 2024 · 6 revisions

APC Support

Support for APC is maturing and reworking variables now supported. The /metrics end point in V0.3.0 on-wards will also support APC servers meaning that one system such as Prometheus and a Grafana dashboard can be used to display historic information from both types of server!.

I don't currently have access to a live APC device and so I would be very grateful for any JSON captures from any APC devices with the model name. If you can help, please attach the JSON files to an issue and I will check and update support for APC when possible.

Note in the configuration file the parameter apc_strip_units now allows the variable data returned by APC to be tidied up for presentation to HomePage.

Automatic translation - From V0.3.0

From the beta releases of V0.3.0 on there is some automatic translation of the APC variables in to NUT format information. This process is adative in that a JSON scrape will return all the APC variables as well as translated NUT values.

The following translations will occur:

NUT Variable Function APC Variable(s) used Notes
ups.model Device model MODEL
ups.delay.shutdown DWAKE
ups.delay.start DSHUTD
ups.beeper.status BEEPSTATE / ALARMDEL Device specific, these will be used as available
ups.temperature ITEMP
ups.status STATFLAG Returns a composite string based in the set bit positions in STATFLAG
ups.load LOADPCT
ups.realpower.nominal NOMPOWER
input.voltage LINEV
output.voltage OUTPUTV
input.voltage.nominal NOMOUTV / NOMINV Device specific, these will be used as available
input.transfer.low LOTRANS
input.transfer.high HITRANS
battery.voltage BATTV
battery.voltage.nominal NOMBATTV
battery.voltage.low NOMBATTV Inferred value, not explicitly sent by APC
battery.charge BCHARGE
battery.charge.low
battery.charge.warning
MBATTCHG
battery.runtime TIMELEFT
battery.runtime.low MINTIMEL

Example configurations

Thanks to Duridblack for this advice.

The data supplied by the APC apcupsd is quite different to that which is supplied by a NUT server, therefore the contents of the JSON will differ.

An example configuration for your homepage services.yaml which returns useful data is:

   - APC Back-UPS ES 700G:
        href: http://X.X.X.X:9995/log?lines=40
        description: APC Back-UPS ES 700G
        icon: http://X.X.X.X:9995/static/favicon.ico
        widget:
            type: customapi
            url: http://X.X.X.X:9995/json?mode=apc&target=Y.Y.Y.Y:3551
            refreshInterval: 60000 # In milliseconds, set to ~60s
            method: GET
            mappings:
                - field:
                    APC Back-UPS ES 700:
                      LINEV
                  label: Input
                  format: text
                - field:
                    APC Back-UPS ES 700: BCHARGE
                  label: Battery charge
                  format: text
                - field:
                    APC Back-UPS ES 700:
                      LOADPCT
                  label: Power
                  format: text
                - field:
                    APC Back-UPS ES 700:
                      UPSMODE
                  label: Status
                  format: text
                  remap:
                    - value: "OL"
                      to: On-Line
                    - value: "OB"
                      to: Discharge