Gather CPU utilization of host as variable for prometheus exporter
-
https://github.com/johnprather/xapi_exporter
But ideally, I'd prefer to:
- short term: do that via XO API/plugin
- long term: replace the current XAPI RRDs mess with directly available Prometheus metrics
-
@olivierlambert but does that really export CPU utilization? From what I saw it only shows memory utilization. Also how does orchestra get these metrics? There must be some low level way to accomplish this, or is xsconsole also using the API for that?
-
Everything is already exported via RRDs (see https://wiki.xenproject.org/wiki/XAPI_RRDs). That's what we use in XO.
But this is far from being nice because:
- Those RRDs are encapsulated in XML, which is costly to parse
- XAPI itself is hammering Xen with requests every 5 secs
So ideally, doing a metrics redesign from Xen to XAPI first, will be better.
-
how does API get these metrics?
-
You mean how XAPI is fetching these metrics?
-
@olivierlambert yes
-
there must be some low level way to do that from dom0
-
That's the plan, yes, there's some Xen stats backend, but it requires some work to modify Xen for a better system.
-
I just installed XCP-ng on a new server and wanted Prometheus metrics too, so I wrote this: https://github.com/MikeDombo/xen-exporter.
It is a simple Python script (which can run in Docker) that collects the metrics from XCP-ng's RRD API. These are the same metrics that you'd see in Xen Orchestra or in the XenServer Console application. In addition to the exporter, I've also created a Grafana dashboard to visualize these metrics too.
-
Ah nice!
Ideally, we'd like to avoid to use the complicated XAPI RRD + XML system. See https://xcp-ng.org/blog/2022/05/25/fetching-metrics-in-xen-why-the-method-matters/
Thanks a lot to bring this, I'll promote it!