Broken rrdtool graphs for collectd-mod-nut pluging when UPS doesn't support all features

After installing the USB, hid, and other drivers/libraries to the target 22.03.3 for my mt76x8, I installed and configured NUT for my APC Back-UPS ES 550G:


However, after installing/configuring the LuCI statistics plugin, some individual graphs are broken:

The following are the corresponding generated databases for this particular UPS. Is rrdtool expecting 8 or more, and that's the reason why?:

root@SVdP2:~# ls -lh /tmp/rrd/SVdP2/nut-BackUPS
-rw-r--r--    1 root     root       12.6K Apr  1 16:42 percent-charge.rrd
-rw-r--r--    1 root     root       12.6K Apr  1 16:42 percent-load.rrd
-rw-r--r--    1 root     root       12.6K Apr  1 16:42 timeleft-battery.rrd
-rw-r--r--    1 root     root       12.6K Apr  1 16:42 voltage-battery.rrd
-rw-r--r--    1 root     root       12.6K Apr  1 16:42 voltage-input.rrd

I also noticed the collectd config is prone to fail and difficult to recover when you mess with it. And a factory refresh led to the same outcome.

Maybe the whole issues are because this UPS doesn't support voltage-output and some other data, and that "confuses" collectd/rrdtool/LuCI? I already tried apcupsd: all the graphs were there, and the values were properly updated when running an 18.06 unofficial fork, but not when running 22.03.3 OpenWrt.

In fact, I made a copy of voltage-input.rrd as voltage-output.rrd, and the AC voltage part of the graphs started to work:


And after cloning charge to temperature-battery, temperature-ups, frequency-input and frequency-output, those graphs started to be shown (with the fake data).

So, the broken graphs are because the missing .rrd databases due parameters/reports not supported by some UPS. IMHO the developers should consider this.

In the meantime, how could I set not to include the missing voltage-output.rrd in order to display the graph for the existing voltage-input.rrd? (I found apcups.js and nut.js files, but don't know whether it would be the right files to modify).

I do my edits in

/www/luci-static/resources/statistics/rrdtool/definitions/nut.js

And also have that file included in backup file list.

1 Like

I tried again and it worked (I made a mistake last time). Thank you very much.

I removed the 7 unsupported features for the Back-UPS, i.e.: "output" AC voltage, "currents" for battery and output, "temperature" of the battery, "power" of the UPS, and "input" "output" frequencies. (And left the 5 supported features: "input" AC voltage, etc.).

Still I think it would be good for the developers to:

  1. Allow us to choose from the collectd-mod-nut plugin what variables/features to monitor or not, or
  2. for rrtdtool to detect the unsupported features (the ones that don't generate an .rrd), and dynamically skip querying for that data, drawing the graph with the valid ones (perhaps writing an "N/A" next to the legend of the missing data if desired)

For instance, in this case AC voltage-input was available, AC voltage-output wasn't, and instead of plotting the graph with only one variable, the graph wasn't been generated, showing a broken image instead.

I also think the vertical axis scale need some polishing too, but I can live with it:

Data skipping implemented with

2 Likes

Thank you very much for the commit. Is already available as part of the nightly builds?

In any case, by looking at the nut.js code, IIUC, I think you're skipping the graphs that otherwise would be broken, that's nice. However, for the first graph (AC voltages) I do have one of the two instances, so adding an else for checking and plotting the available instance rather than none it would be better. For details, please check the previous screen captures.

The code is designed to draw the graph when at least one instance is available. If it is, then only graph lines with existing data are rendered.

Excellent!

If you want somebody to check a new build with those changes, let me know.

You can already build it by yourself and test.

The buildbot will automatically build it for all architectures in the next 1-2 days. You can test it latest then.

You can grab the updated file from here and replace your nut.js
Thanks again, @jow! :slight_smile:

2 Likes

Thanks for all the replies.

With my modified nut.js it's working fine, except for the vertical scales/range. I mean, 200V max for a normal 117V is too much, and 100V min for 117V nominal can be too close, I'd prefer 90V or 80V.


Or sometimes the max value is too close to the graph:

FWIW, this is the default "Medium" sensitivity range for the APC:

root@SVdP2:~# apcaccess |grep SENSE
SENSE    : Medium
root@SVdP2:~# apcaccess |grep TRANS
LOTRANS  : 92.0 Volts
HITRANS  : 139.0 Volts

Same for the battery voltage: if the nomimal value is 12V (13.8V), 20V is a tad high.

Anyways, I've just tried the new nut.js. I confirm the broken graphs issue is fixed:


Well done guys. Looking forward for the improved vertical scale,

PS: I don't know whether a comment/update on the RFC 1653 would be in order.

Update: I'm noticing the following errors, I don't know whether it could be related with this?

root@SVdP2:~#  dmesg |tail
[142575.811373] do_page_fault(): sending SIGSEGV to rrdtool for invalid read access from 77d2a1e7
[142575.811394] epc = 77dc4fe5 in librrd.so.0.0.0[77d9f000+40000]
[142575.811434] ra  = 77da5cc3 in librrd.so.0.0.0[77d9f000+40000]
[142575.813538] do_page_fault(): sending SIGSEGV to rrdtool for invalid read access from 77d2e1e7
[142575.813558] epc = 77dc8fe5 in librrd.so.0.0.0[77da3000+40000]
[142575.813922] ra  = 77da9cc3 in librrd.so.0.0.0[77da3000+40000]
root@SVdP2:~# dmesg |grep 'SIGSEGV\|librrd.so'
[ 2053.590011] do_page_fault(): sending SIGSEGV to rrdtool for invalid read access from 77c801f7
[ 2053.590032] epc = 77d1cfe5 in librrd.so.0.0.0[77cf7000+40000]
[ 2053.590069] ra  = 77cfdcc3 in librrd.so.0.0.0[77cf7000+40000]
[ 2053.592773] do_page_fault(): sending SIGSEGV to rrdtool for invalid read access from 77ca41f7
[ 2053.592793] epc = 77d40fe5 in librrd.so.0.0.0[77d1b000+40000]
[ 2053.592830] ra  = 77d21cc3 in librrd.so.0.0.0[77d1b000+40000]
[ 2053.674805] do_page_fault(): sending SIGSEGV to rrdtool for invalid read access from 77cb21f7
[ 2053.674826] epc = 77d5ffe5 in librrd.so.0.0.0[77d3a000+40000]
[ 2053.674863] ra  = 77d40cc3 in librrd.so.0.0.0[77d3a000+40000]
[ 7600.228594] do_page_fault(): sending SIGSEGV to rrdtool for invalid read access from 77ca81e7
[ 7600.228615] epc = 77d51fe5 in librrd.so.0.0.0[77d2c000+40000]
[ 7600.228653] ra  = 77d32cc3 in librrd.so.0.0.0[77d2c000+40000]
[142575.811373] do_page_fault(): sending SIGSEGV to rrdtool for invalid read access from 77d2a1e7
[142575.811394] epc = 77dc4fe5 in librrd.so.0.0.0[77d9f000+40000]
[142575.811434] ra  = 77da5cc3 in librrd.so.0.0.0[77d9f000+40000]
[142575.813538] do_page_fault(): sending SIGSEGV to rrdtool for invalid read access from 77d2e1e7
[142575.813558] epc = 77dc8fe5 in librrd.so.0.0.0[77da3000+40000]
[142575.813922] ra  = 77da9cc3 in librrd.so.0.0.0[77da3000+40000]

If it's needed to open a new thread, please let me know.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.