Skip to content

CP-308049: rrdview tool #6468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

edwintorok
Copy link
Contributor

@edwintorok edwintorok commented May 14, 2025

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

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.

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)

This is just a starting point to be able to visualize this data somehow, and we can improve the actual plotting later.

Signed-off-by: Edwin Török <[email protected]>
Add 'tyre' dependency.

Signed-off-by: Edwin Török <[email protected]>
@edwintorok
Copy link
Contributor Author

Also we finally got a use for the tyre module!

Copy link
Contributor

@Vincent-lau Vincent-lau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want a spec change to install this in dom0 for debugging?

@psafont
Copy link
Member

psafont commented May 15, 2025

Do we want a spec change to install this in dom0 for debugging?

The executable is not installed as part of the package (the public name is commented out), so if we want it installed the dune file needs to be changed as well

@lindig
Copy link
Contributor

lindig commented May 21, 2025

Merge this first, then update the spec file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants