Skip to content

Commit 47d8133

Browse files
authored
CP-308049: rrdview tool (#6468)
I wrote this in ~2022, so I don't fully remember how it all works, but I tried to document what I know in the commit message, in the CLI flag docs and here: ``` scp -r root@$YOURBOX:/var/lib/xcp/blobs/rrds /tmp/rrds dune exec ./rrdview.exe -- /tmp/rrds bash /tmp/rrds/16db833b-7cd6-4b69-9037-144076c71033.cpu_avg.DERIVE.sh ``` ![rrd](https://github.com/user-attachments/assets/b3c98936-cc29-4871-b4ea-1511853d623e) Viewing RRDs produced by xcp-rrdd is difficult, because the format is incompatible with rrdtool. rrdtool has a hardcoded limit of 20 char for RRD names for backward compat with its binary format. Steps: * given a directory of xml .gz files containing xcp-rrdd produced rrds * invokes itself recursively with each file in turn using xargs -P (easy way to parallelize on OCaml 4) * load all RRDs, and split them into separate files, allowing us to shorten many of their names without conflicts * some names are still too long, there is a builtin translation table to shorten these * once split an .rrd file is created using 'rrdtool restore'. This can further be queried/inspected/transformed by rrdtool as needed * a .sh script is produced that can plot the RRD if desired. There are many RRDs so plotting isn't done automatically yet. RRDs contain min/avg/max usually, so this is drawn as a strong line at the average, and an area in a lighter color for min/max (especially useful for historic data that has been aggregated). Caveats: * we don't know the unit name, that is part of the XAPI metadata, but not the XML apparently? * separate plots are generated for separate intervals, it'd be nice to join all these into the same graph * the visualization type is not the best for all RRDs, some might benefit from a smoother line, etc. * for now the tool is just built, but not installed (that'll require a .spec change too and can be done later) * there is some code there to start parsing the data source definitions, eventually I wanted to plot the data using OCaml instead of rrdtool (e.g. generate Vega/Vega-lite graphs), but I can't find which branch I put *that* code on, what I have here is incomplete (or maybe I never wrote that part, just thought about it). We could trim the dead code from here if needed, but it might be useful if we continue improving the tool later, so for now I left the parsing in. This is just a starting point to be able to visualize this data somehow, and we can improve the actual plotting later.
2 parents 85d5c92 + 8deed51 commit 47d8133

File tree

7 files changed

+1509
-754
lines changed

7 files changed

+1509
-754
lines changed

0 commit comments

Comments
 (0)