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

    Xen Orchestra OpenMetrics Plugin - Grafana Dashboard

    Scheduled Pinned Locked Moved Infrastructure as Code
    5 Posts 4 Posters 136 Views 4 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.
    • M Offline
      MajorP93
      last edited by MajorP93

      Hello XCP-ng community!

      Since Vates released the new OpenMetrics plugin for Xen Orchestra we now have an official, built-in exporter for Prometheus metrics!

      I was using xen-exporter before in order to make hypervisor internal RRD database available in the form of Prometheus metrics.
      I migrated to the new plugin which works just fine.

      I updated the Grafana dashboard that I was using in order to be compatible with the official OpenMetrics plugin and thought "why not share it with other users"?

      In case you are interested you can find my dashboard JSON here: https://gist.github.com/MajorP93/3a933a6f03b4c4e673282fb54a68474b

      It is based on the xen-exporter dashboard made by MikeDombo: https://grafana.com/grafana/dashboards/16588-xen/

      In case you also use Prometheus for scraping Xen Orchestra OpenMetrics plugin in combination with Grafana you can copy the JSON from my gist, import it and you are ready to go!

      Hope it helps!

      Might even be a good idea to include the dashboard as an example in the Xen Orchestra documentation. 🙂

      Best regards

      Mang0MusztardaM 1 Reply Last reply Reply Quote 3
      • Mang0MusztardaM Offline
        Mang0Musztarda @MajorP93
        last edited by

        @MajorP93 hi, how can i scrape openmetrics endpoint?
        i set up openmetrics plugin prometheus secret, enabled it, and ten tried to use curl like that: curl -H "Authorization: Bearer abc123" http://localhost:9004
        but response i got was
        {"error":"Query authentication does not match server setting"}
        what am i doing wrong?

        florentF M 2 Replies Last reply Reply Quote 0
        • florentF Offline
          florent Vates 🪐 XO Team @Mang0Musztarda
          last edited by

          @Mang0Musztarda can you try http://<xo>/openmetrics
          the :9004 is more an internal route ( on xoa it is behind the proxy )

          1 Reply Last reply Reply Quote 0
          • mpitonM Offline
            mpiton
            last edited by

            @Mang0Musztarda

            To add to what @florent said, here's the complete picture:

            Why your command failed:

            1. Wrong URL: localhost:9004 is the internal port that only listens on
              127.0.0.1. It's proxied through xo-server at /openmetrics/metrics.

            2. Wrong token: The error "Query authentication does not match server setting"
              means your Bearer token doesn't match the one configured in the plugin.

            Correct approach:

            1. Get your secret from: Settings → Plugins → OpenMetrics → "Prometheus secret"

            2. Use the proxied endpoint:

              curl -H "Authorization: Bearer <your-actual-secret>" \                                                                                                                                                                                   
                   http://<your-xo-server>/openmetrics/metrics                                                                                                                                                                                         
                                                                                                                                                                                                                                                       
              
            3. For health checks (no auth required):
              curl http://<your-xo-server>/openmetrics/health
              Returns: {"status":"ok"}

            Full documentation is available at:
            https://docs.xen-orchestra.com/advanced#openmetrics--prometheus-integration

            It covers Prometheus configuration, available metrics, Grafana dashboards,
            alerting rules, and troubleshooting.

            @MajorP93 Thanks for sharing your Grafana dashboard! It could indeed be a nice
            addition to link it from the official docs as a community example.

            1 Reply Last reply Reply Quote 1
            • M Offline
              MajorP93 @Mang0Musztarda
              last edited by MajorP93

              @Mang0Musztarda said in Xen Orchestra OpenMetrics Plugin - Grafana Dashboard:

              @MajorP93 hi, how can i scrape openmetrics endpoint?
              i set up openmetrics plugin prometheus secret, enabled it, and ten tried to use curl like that: curl -H "Authorization: Bearer abc123" http://localhost:9004
              but response i got was
              {"error":"Query authentication does not match server setting"}
              what am i doing wrong?

              Hey!
              I scrape it like so:

              root@prometheus01:~# cat /etc/prometheus/scrape_configs/xen-orchestra-openmetrics.yml 
              scrape_configs:
                - job_name: xen-orchestra
                  honor_labels: true
                  scrape_interval: 30s
                  scrape_timeout: 20s
                  scheme: https
                  tls_config:
                    insecure_skip_verify: true
                  bearer_token_file: /etc/prometheus/bearer.token
                  metrics_path: /openmetrics/metrics
                  static_configs:
                  - targets:
                    - xen-orchestra.domain.local
              

              /etc/prometheus/bearer.token file contains the bearer token as configured in openmetrics xen orchestra plugin.

              best regards

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