XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Gather CPU utilization of host as variable for prometheus exporter

    Scheduled Pinned Locked Moved Compute
    16 Posts 5 Posters 4.0k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • olivierlambertO Online
      olivierlambert Vates 🪐 Co-Founder CEO
      last edited by

      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
      P 1 Reply Last reply Reply Quote 0
      • P Offline
        petr.bena @olivierlambert
        last edited by

        @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?

        1 Reply Last reply Reply Quote 0
        • olivierlambertO Online
          olivierlambert Vates 🪐 Co-Founder CEO
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • P Offline
            petr.bena
            last edited by

            how does API get these metrics?

            1 Reply Last reply Reply Quote 0
            • olivierlambertO Online
              olivierlambert Vates 🪐 Co-Founder CEO
              last edited by

              You mean how XAPI is fetching these metrics?

              P 1 Reply Last reply Reply Quote 0
              • P Offline
                petr.bena @olivierlambert
                last edited by

                @olivierlambert yes

                1 Reply Last reply Reply Quote 0
                • P Offline
                  petr.bena
                  last edited by

                  there must be some low level way to do that from dom0

                  1 Reply Last reply Reply Quote 0
                  • olivierlambertO Online
                    olivierlambert Vates 🪐 Co-Founder CEO
                    last edited by

                    That's the plan, yes, there's some Xen stats backend, but it requires some work to modify Xen for a better system.

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      MikeDombo
                      last edited by

                      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.

                      Example dashboard

                      1 Reply Last reply Reply Quote 1
                      • olivierlambertO Online
                        olivierlambert Vates 🪐 Co-Founder CEO
                        last edited by

                        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!

                        S 1 Reply Last reply Reply Quote 1
                        • S Offline
                          ScarfAntennae @olivierlambert
                          last edited by

                          I was about to link Mike's work here, but wanted to say how we desperately need a metrics system that would be exposed from a centralized location. There's no way in hell I'm giving a docker host credential access to the hypervisor it resides on (and all the other hypervisors) - on the other hand, if the metrics were exposed only via XO and limited in terms of where these metrics could be accessed from, now that would be a sold implementation.

                          S T 2 Replies Last reply Reply Quote 0
                          • S Offline
                            ScarfAntennae @ScarfAntennae
                            last edited by

                            Related: https://xcp-ng.org/forum/topic/9160/xen-orchestra-prometheus-backup-metrics/10

                            1 Reply Last reply Reply Quote 0
                            • T Offline
                              tsrats @ScarfAntennae
                              last edited by tsrats

                              @ScarfAntennae said in Gather CPU utilization of host as variable for prometheus exporter:

                              I was about to link Mike's work here, but wanted to say how we desperately need a metrics system that would be exposed from a centralized location. There's no way in hell I'm giving a docker host credential access to the hypervisor it resides on (and all the other hypervisors) - on the other hand, if the metrics were exposed only via XO and limited in terms of where these metrics could be accessed from, now that would be a sold implementation.

                              Looks like this wish has been granted with the latest Xen-Orchestra release.

                              I was able to successfully scrape the metrics from XO using Prometheus. I was wondering if there was any links or json file examples of a good Grafana dashboard to show these metrics? I saw example screenshots in the blog post here but nothing on grafana.com, here in the forums, or on Github had the config. I saw PR #9333 with documentation about the feature, and great rules for alerting, but also no dashboard configs. It has some beginning parts for variables and 2 visualisations, but a copy of the example in the blog would be wonderful as a starting point.

                              1 Reply Last reply Reply Quote 0
                              • olivierlambertO Online
                                olivierlambert Vates 🪐 Co-Founder CEO
                                last edited by olivierlambert

                                Question for @team-xo-backend 🙂

                                1 Reply Last reply Reply Quote 0
                                • S Offline
                                  ScarfAntennae
                                  last edited by ScarfAntennae

                                  Yay! Santa came early this year!!

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post